Class StreamSegment
Represents read-only view over the portion of underlying stream.
Inheritance
StreamSegment
Assembly: DotNext.IO.dll
Syntax
public sealed class StreamSegment : Stream, IAsyncDisposable, IDisposable
Constructors
|
Improve this Doc
View Source
StreamSegment(Stream, Boolean)
Initializes a new segment of the specified stream.
Declaration
public StreamSegment(Stream stream, bool leaveOpen = true)
Parameters
Type |
Name |
Description |
Stream |
stream |
The underlying stream represented by the segment.
|
Boolean |
leaveOpen |
true to leave stream open after the object is disposed; otherwise, false.
|
Exceptions
Properties
|
Improve this Doc
View Source
BaseStream
Declaration
public Stream BaseStream { get; }
Property Value
|
Improve this Doc
View Source
CanRead
Gets a value indicating whether the current stream supports reading.
Declaration
public override bool CanRead { get; }
Property Value
Type |
Description |
Boolean |
true if the stream supports reading; otherwise, false.
|
Overrides
|
Improve this Doc
View Source
CanSeek
Gets a value indicating whether the current stream supports seeking.
Declaration
public override bool CanSeek { get; }
Property Value
Type |
Description |
Boolean |
true if the stream supports seeking; otherwise, false.
|
Overrides
|
Improve this Doc
View Source
CanTimeout
Declaration
public override bool CanTimeout { get; }
Property Value
Overrides
|
Improve this Doc
View Source
CanWrite
Gets a value indicating whether the current stream supports writing.
Declaration
public override bool CanWrite { get; }
Property Value
Type |
Description |
Boolean |
Always false.
|
Overrides
|
Improve this Doc
View Source
Length
Declaration
public override long Length { get; }
Property Value
Overrides
|
Improve this Doc
View Source
Position
Declaration
public override long Position { get; set; }
Property Value
Overrides
|
Improve this Doc
View Source
ReadTimeout
Declaration
public override int ReadTimeout { get; set; }
Property Value
Overrides
|
Improve this Doc
View Source
WriteTimeout
Declaration
public override int WriteTimeout { get; set; }
Property Value
Overrides
Methods
|
Improve this Doc
View Source
Adjust(Int64, Int64)
Establishes segment bounds.
Declaration
public void Adjust(long offset, long length)
Parameters
Type |
Name |
Description |
Int64 |
offset |
The offset in the underlying stream.
|
Int64 |
length |
The length of the segment.
|
Exceptions
Type |
Condition |
ArgumentOutOfRangeException |
length is larger than the reamining length of the underlying stream; or offset if greater than the length of the underlying stream.
|
|
Improve this Doc
View Source
BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)
Declaration
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
Parameters
Returns
Overrides
|
Improve this Doc
View Source
BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)
Declaration
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
Parameters
Returns
Overrides
|
Improve this Doc
View Source
Dispose(Boolean)
Declaration
protected override void Dispose(bool disposing)
Parameters
Type |
Name |
Description |
Boolean |
disposing |
|
Overrides
|
Improve this Doc
View Source
DisposeAsync()
Declaration
public override ValueTask DisposeAsync()
Returns
Overrides
|
Improve this Doc
View Source
EndRead(IAsyncResult)
Declaration
public override int EndRead(IAsyncResult asyncResult)
Parameters
Returns
Overrides
|
Improve this Doc
View Source
EndWrite(IAsyncResult)
Declaration
public override void EndWrite(IAsyncResult asyncResult)
Parameters
Overrides
|
Improve this Doc
View Source
Flush()
Declaration
public override void Flush()
Overrides
|
Improve this Doc
View Source
FlushAsync(CancellationToken)
Declaration
public override Task FlushAsync(CancellationToken token = default(CancellationToken))
Parameters
Returns
Overrides
|
Improve this Doc
View Source
Read(Byte[], Int32, Int32)
Declaration
public override int Read(byte[] buffer, int offset, int count)
Parameters
Returns
Overrides
|
Improve this Doc
View Source
Read(Span<Byte>)
Declaration
public override int Read(Span<byte> buffer)
Parameters
Returns
Overrides
|
Improve this Doc
View Source
ReadAsync(Byte[], Int32, Int32, CancellationToken)
Declaration
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken token = default(CancellationToken))
Parameters
Returns
Overrides
|
Improve this Doc
View Source
ReadAsync(Memory<Byte>, CancellationToken)
Declaration
public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken token = default(CancellationToken))
Parameters
Returns
Overrides
|
Improve this Doc
View Source
ReadByte()
Declaration
public override int ReadByte()
Returns
Overrides
|
Improve this Doc
View Source
Seek(Int64, SeekOrigin)
Declaration
public override long Seek(long offset, SeekOrigin origin)
Parameters
Returns
Overrides
|
Improve this Doc
View Source
SetLength(Int64)
Declaration
public override void SetLength(long value)
Parameters
Type |
Name |
Description |
Int64 |
value |
|
Overrides
|
Improve this Doc
View Source
Write(Byte[], Int32, Int32)
Declaration
public override void Write(byte[] buffer, int offset, int count)
Parameters
Overrides
|
Improve this Doc
View Source
Write(ReadOnlySpan<Byte>)
Declaration
public override void Write(ReadOnlySpan<byte> buffer)
Parameters
Overrides
|
Improve this Doc
View Source
WriteAsync(Byte[], Int32, Int32, CancellationToken)
Declaration
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken token = default(CancellationToken))
Parameters
Returns
Overrides
|
Improve this Doc
View Source
WriteAsync(ReadOnlyMemory<Byte>, CancellationToken)
Declaration
public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Returns
Overrides
|
Improve this Doc
View Source
WriteByte(Byte)
Declaration
public override void WriteByte(byte value)
Parameters
Type |
Name |
Description |
Byte |
value |
|
Overrides
Implements
Extension Methods