VirtualFileStream Class
Namespace: Stride.Core.SerializationAssembly: Stride.Core.IO.dll
A multithreaded wrapper over a Stream, used by the VirtualFileSystem. It also allows restricted access to subparts of the Stream (useful for serialization and data streaming).
Derived from VirtualFileStream:
public class VirtualFileStream : NativeStream, IDisposable
Name | Description | |
---|---|---|
Constructors | ||
VirtualFileStream(Stream, Int64, Int64, Boolean, Boolean) | Initializes a new instance of the VirtualFileStream class. |
|
Fields | ||
endPosition | ||
startPosition | ||
virtualFileStream | ||
Properties | ||
CanRead | ||
CanSeek | ||
CanWrite | ||
EndPosition | ||
InternalStream | ||
Length | ||
Position | ||
StartPosition | ||
Methods | ||
Dispose(Boolean) | ||
Flush() | ||
Read(Byte[], Int32, Int32) | ||
ReadByte() | ||
Seek(Int64, SeekOrigin) | ||
SetLength(Int64) | ||
Write(Byte[], Int32, Int32) | ||
WriteByte(Byte) |
Constructors
VirtualFileStream(Stream, Int64, Int64, Boolean, Boolean)
Initializes a new instance of the VirtualFileStream class.
public VirtualFileStream(Stream internalStream, long startPosition = 0L, long endPosition = -1L, bool disposeInternalStream = true, bool seekToBeginning = true)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | internalStream | The internal stream. |
System.Int64 | startPosition | The start position. |
System.Int64 | endPosition | The end position. |
System.Boolean | disposeInternalStream | if set to |
System.Boolean | seekToBeginning |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | startPosition and endPosition doesn't fit inside current bounds |
System.NotSupportedException | Attempted to create a VirtualFileStream from a Stream which doesn't support seeking. |
Fields
endPosition
protected readonly long endPosition
Field Value
Type | Description |
---|---|
System.Int64 |
startPosition
protected readonly long startPosition
Field Value
Type | Description |
---|---|
System.Int64 |
virtualFileStream
protected VirtualFileStream virtualFileStream
Field Value
Type | Description |
---|---|
VirtualFileStream |
Properties
CanRead
public override bool CanRead { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
System.IO.Stream.CanRead
CanSeek
public override bool CanSeek { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
System.IO.Stream.CanSeek
CanWrite
public override bool CanWrite { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
System.IO.Stream.CanWrite
EndPosition
public long EndPosition { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
InternalStream
public Stream InternalStream { get; protected set; }
Property Value
Type | Description |
---|---|
System.IO.Stream |
Length
public override long Length { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Overrides
System.IO.Stream.Length
Position
public override long Position { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
Overrides
System.IO.Stream.Position
StartPosition
public long StartPosition { get; }
Property Value
Type | Description |
---|---|
System.Int64 |
Methods
Dispose(Boolean)
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing |
Overrides
System.IO.Stream.Dispose(System.Boolean)
Flush()
public override void Flush()
Overrides
System.IO.Stream.Flush()
Read(Byte[], Int32, Int32)
public override int Read(byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | |
System.Int32 | offset | |
System.Int32 | count |
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
System.IO.Stream.Read(System.Byte[], System.Int32, System.Int32)
ReadByte()
public override int ReadByte()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
System.IO.Stream.ReadByte()
Seek(Int64, SeekOrigin)
public override long Seek(long offset, SeekOrigin origin)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | offset | |
System.IO.SeekOrigin | origin |
Returns
Type | Description |
---|---|
System.Int64 |
Overrides
System.IO.Stream.Seek(System.Int64, System.IO.SeekOrigin)
SetLength(Int64)
public override void SetLength(long value)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | value |
Overrides
System.IO.Stream.SetLength(System.Int64)
Write(Byte[], Int32, Int32)
public override void Write(byte[] buffer, int offset, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | |
System.Int32 | offset | |
System.Int32 | count |
Overrides
System.IO.Stream.Write(System.Byte[], System.Int32, System.Int32)
WriteByte(Byte)
public override void WriteByte(byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value |
Overrides
System.IO.Stream.WriteByte(System.Byte)
Inherited Members
System.IO.Stream.Null
System.IO.Stream.BeginRead(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.BeginWrite(System.Byte[], System.Int32, System.Int32, System.AsyncCallback, System.Object)
System.IO.Stream.Close()
System.IO.Stream.CopyTo(System.IO.Stream)
System.IO.Stream.CopyTo(System.IO.Stream, System.Int32)
System.IO.Stream.CopyToAsync(System.IO.Stream)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32)
System.IO.Stream.CopyToAsync(System.IO.Stream, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.CreateWaitHandle()
System.IO.Stream.Dispose()
System.IO.Stream.EndRead(System.IAsyncResult)
System.IO.Stream.EndWrite(System.IAsyncResult)
System.IO.Stream.FlushAsync()
System.IO.Stream.FlushAsync(System.Threading.CancellationToken)
System.IO.Stream.ObjectInvariant()
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.ReadAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.Synchronized(System.IO.Stream)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32)
System.IO.Stream.WriteAsync(System.Byte[], System.Int32, System.Int32, System.Threading.CancellationToken)
System.IO.Stream.CanTimeout
System.IO.Stream.ReadTimeout
System.IO.Stream.WriteTimeout
System.MarshalByRefObject.GetLifetimeService()
System.MarshalByRefObject.InitializeLifetimeService()
System.MarshalByRefObject.MemberwiseClone(System.Boolean)