Otter SDK Reference
Version:

PositionStream Class

Represents a stream that has a position and possibly a length.

Inheritance Hierarchy

  • object
    • System.MarshalByRefObject
      • System.IO.Stream
        • Inedo.IO.PositionStream

Syntax

public class PositionStream : System.IO.Stream, System.IDisposable

Constructors

Name Description
PositionStream(System.IO.Stream baseStream)

Initializes a new instance of the PositionStream class.

PositionStream(System.IO.Stream baseStream, long length)

Initializes a new instance of the PositionStream class.

Properties

Name Description
CanRead

Gets a value indicating whether the current stream supports reading.

CanSeek

Gets a value indicating whether the current stream supports seeking.

CanWrite

Gets a value indicating whether the current stream supports writing.

Length

Gets the length of the current stream in bytes.

Position

Gets or sets the position of the current stream in bytes.

Methods

Name Description
CopyToAsync(System.IO.Stream destination, int bufferSize, System.Threading.CancellationToken cancellationToken)

Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.

Dispose(bool disposing)

Releases the unmanaged resources used by the System.IO.Stream and optionally releases the managed resources.

Flush

Clears all buffers for this stream and causes any buffered data to be written to the underlying device.

FlushAsync(System.Threading.CancellationToken cancellationToken)

Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.

Read(byte[] buffer, int offset, int count)

Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken)

Asynchronously reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

ReadByte

Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.

Seek(long offset, System.IO.SeekOrigin origin)

Sets the position within the current stream.

SetLength(long value)

Sets the length of the current stream.

Write(byte[] buffer, int offset, int count)

Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

WriteAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken)

Asynchronously writes a sequence of bytes to the current stream, advances the current position within this stream by the number of bytes written, and monitors cancellation requests.

WriteByte(byte value)

Writes a byte to the current position in the stream and advances the position within the stream by one byte.