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](#CanRead)
- Gets a value indicating whether the underlying stream supports reading.[CanSeek](#CanSeek)
- Gets a value indicating whether the underlying stream supports seeking.[CanWrite](#CanWrite)
- Gets a value indicating whether the underlying stream supports writing.[Flush()](#Flush)
- Not documented yet.[Length](#Length)
- Gets the partial stream’s length in bytes.[Position](#Position)
- Gets the partial stream’s current byte position.[Read(byte[], int, int)](#Read_byte_int_int)
- Not documented yet.[Seek(long, System.IO.SeekOrigin)](#Seek_long_System_IO_SeekOrigin)
- Not documented yet.[SetLength(long)](#SetLength_long)
- Not documented yet.[Write(byte[], int, int)](#Write_byte_int_int)
- Not documented yet.
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.
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.
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
.
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
.
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
.
public override long Length { get; }
Gets the partial stream’s length in bytes.
Returns:
The partial stream’s length in bytes.
public override long Position { get; set; }
Gets the partial stream’s current byte position.
Returns:
The partial stream’s current byte position.
public override void Flush();
Not documented yet.
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 .
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.
public override void SetLength( long value);
Not documented yet.
Parameters:
- value: The parameter value is a 64-bit signed integer.
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.