PeterO.PartialStream
PeterO.PartialStream
public sealed class PartialStream : System.IO.Stream, System.IAsyncDisposable, System.IDisposable
Represents a portion of another data stream. For this to work, the underlying stream must be seekable and have a known length.
Member Summary
CanRead
- Gets a value indicating whether the underlying stream supports reading.CanSeek
- Gets a value indicating whether the underlying stream supports seeking.CanWrite
- Gets a value indicating whether the underlying stream supports writing.Flush()
- Not documented yet.Length
- Gets the partial stream's length in bytes.Position
- Gets the partial stream's current byte position.Read(byte[], int, int)
- Not documented yet.Seek(long, System.IO.SeekOrigin)
- Not documented yet.SetLength(long)
- Not documented yet.Write(byte[], int, int)
- Not documented yet.
PartialStream Constructor
public PartialStream( System.IO.Stream stream, long start, long length);
Initializes a new instance of the PeterO.PartialStream class.
Parameters:
stream: The parameter stream is a Stream object.
start: The parameter start is a 64-bit signed integer.
length: The parameter length is a 64-bit signed integer.
PartialStream Constructor
public PartialStream( System.IO.Stream stream, long start, long length, bool closeOnDispose);
Initializes a new instance of the PeterO.PartialStream class.
Parameters:
stream: The parameter stream is a Stream object.
start: The start of the partial stream from the underlying stream.
length: The length of the partial stream in bytes.
closeOnDispose: If true, closes the underlying stream when disposing the partial stream.
Exceptions:
System.ArgumentException: The parameter stream doesn't support seeking, the length or start is less than 0 or greater than the underlying stream's length, or the partial stream would go beyond the underlying stream.
System.ArgumentNullException: The parameter stream or stream is null.
CanRead
public override bool CanRead { get; }
Gets a value indicating whether the underlying stream supports reading.
Returns:
true
If the underlying stream supports reading; otherwise, false
.
CanSeek
public override bool CanSeek { get; }
Gets a value indicating whether the underlying stream supports seeking.
Returns:
true
If the underlying stream supports seeking; otherwise, false
.
CanWrite
public override bool CanWrite { get; }
Gets a value indicating whether the underlying stream supports writing.
Returns:
true
If the underlying stream supports writing; otherwise, false
.
Length
public override long Length { get; }
Gets the partial stream's length in bytes.
Returns:
The partial stream's length in bytes.
Position
public override long Position { get; set; }
Gets the partial stream's current byte position.
Returns:
The partial stream's current byte position.
Flush
public override void Flush();
Not documented yet.
Read
public override int Read( byte[] buffer, int offset, int count);
Not documented yet.
Parameters:
buffer: The parameter buffer is a.Byte[] object.
offset: An index starting at 0 showing where the desired portion of buffer begins.
count: The number of elements in the desired portion of buffer (but not more than buffer 's length).
Return Value:
A 32-bit signed integer.
Exceptions:
T:System.ArgumentException: Either offset or count is less than 0 or greater than buffer 's length, or buffer 's length minus offset is less than count .
System.ArgumentNullException: The parameter buffer is null.
System.ArgumentException: Either offset or count is less than 0 or greater than buffer 's length, or buffer 's length minus offset is less than count .
Seek
public override long Seek( long offset, System.IO.SeekOrigin origin);
Not documented yet.
Parameters:
offset: The parameter offset is a 64-bit signed integer.
origin: The parameter origin is a.IO.SeekOrigin object.
Return Value:
A 64-bit signed integer.
SetLength
public override void SetLength( long value);
Not documented yet.
Parameters:
- value: The parameter value is a 64-bit signed integer.
Write
public override void Write( byte[] buffer, int offset, int count);
Not documented yet.
Parameters:
buffer: The parameter buffer is a.Byte[] object.
offset: An index starting at 0 showing where the desired portion of buffer begins.
count: The number of elements in the desired portion of buffer (but not more than buffer 's length).
Exceptions:
System.ArgumentException: Either offset or count is less than 0 or greater than buffer 's length, or buffer 's length minus offset is less than count .
System.ArgumentNullException: The parameter buffer is null.