C# Class CqlSharp.Memory.PoolMemoryStream

MemoryStream that uses memory from the MemoryPool
Inheritance: Stream
Exibir arquivo Open project: reuzel/CqlSharp Class Usage Examples

Public Methods

Method Description
CopyTo ( Stream destination ) : void

Reads the bytes from the current stream and writes them to another stream.

CopyTo ( Stream destination, int bufferSize ) : void

Reads the bytes from the current stream and writes them to another stream, using a specified buffer size.

CopyToAsync ( Stream destination, int bufferSize, CancellationToken cancellationToken ) : Task

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

Flush ( ) : void

When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.

FlushAsync ( CancellationToken cancellationToken ) : Task

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

PoolMemoryStream ( ) : System

Initializes a new instance of the PoolMemoryStream class.

PoolMemoryStream ( byte data ) : System

Initializes a new instance of the PoolMemoryStream class.

PoolMemoryStream ( long size ) : System

Initializes a new instance of the PoolMemoryStream class.

Read ( byte buffer, int offset, int count ) : int

When overridden in a derived class, 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, CancellationToken cancellationToken ) : Task

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

ReadByte ( ) : int

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, SeekOrigin origin ) : long

When overridden in a derived class, sets the position within the current stream.

SetLength ( long value ) : void

When overridden in a derived class, sets the length of the current stream.

Write ( byte buffer, int offset, int count ) : void

When overridden in a derived class, 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, CancellationToken cancellationToken ) : Task

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 ) : void

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

this ( long index ) : byte

Gets or sets the System.Byte at the specified index.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Private Methods

Method Description
AddBuffer ( ) : void

Adds a buffer.

SetLengthInternal ( long value ) : void

sets the length of the current stream.

WriteInternal ( byte buffer, int offset, int count ) : void

Writes the internal.

Method Details

CopyTo() public method

Reads the bytes from the current stream and writes them to another stream.
public CopyTo ( Stream destination ) : void
destination Stream The stream to which the contents of the current stream will be copied.
return void

CopyTo() public method

Reads the bytes from the current stream and writes them to another stream, using a specified buffer size.
PoolMemoryStream
public CopyTo ( Stream destination, int bufferSize ) : void
destination Stream The stream to which the contents of the current stream will be copied.
bufferSize int Ignored. The internal buffersize is always used.
return void

CopyToAsync() public method

Asynchronously reads the bytes from the current stream and writes them to another stream, using a specified buffer size and cancellation token.
PoolMemoryStream
public CopyToAsync ( Stream destination, int bufferSize, CancellationToken cancellationToken ) : Task
destination Stream The stream to which the contents of the current stream will be copied.
bufferSize int /// The size, in bytes, of the buffer. This value must be greater than zero. The default size is /// 4096. ///
cancellationToken System.Threading.CancellationToken /// The token to monitor for cancellation requests. The default value is /// /// . ///
return Task

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

Flush() public method

When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.
An I/O error occurs.
public Flush ( ) : void
return void

FlushAsync() public method

Asynchronously clears all buffers for this stream, causes any buffered data to be written to the underlying device, and monitors cancellation requests.
public FlushAsync ( CancellationToken cancellationToken ) : Task
cancellationToken System.Threading.CancellationToken /// The token to monitor for cancellation requests. The default value is /// /// . ///
return Task

PoolMemoryStream() public method

Initializes a new instance of the PoolMemoryStream class.
public PoolMemoryStream ( ) : System
return System

PoolMemoryStream() public method

Initializes a new instance of the PoolMemoryStream class.
public PoolMemoryStream ( byte data ) : System
data byte The data.
return System

PoolMemoryStream() public method

Initializes a new instance of the PoolMemoryStream class.
public PoolMemoryStream ( long size ) : System
size long The size.
return System

Read() public method

When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
/// The sum of /// /// and /// /// is larger than the buffer length. /// /// /// is null. /// /// /// or /// /// is negative. /// An I/O error occurs. The stream does not support reading. Methods were called after the stream was closed.
public Read ( byte buffer, int offset, int count ) : int
buffer byte /// An array of bytes. When this method returns, the buffer contains the specified byte array with the values between /// /// and ( + - 1) replaced by the bytes read from the current source. ///
offset int /// The zero-based byte offset in at which to begin storing the data read /// from the current stream. ///
count int The maximum number of bytes to be read from the current stream.
return int

ReadAsync() public method

Asynchronously reads a sequence of bytes from the current stream, advances the position within the stream by the number of bytes read, and monitors cancellation requests.
public ReadAsync ( byte buffer, int offset, int count, CancellationToken cancellationToken ) : Task
buffer byte The buffer to write the data into.
offset int The byte offset in at which to begin writing data from the stream.
count int The maximum number of bytes to read.
cancellationToken System.Threading.CancellationToken /// The token to monitor for cancellation requests. The default value is /// /// . ///
return Task

ReadByte() public method

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.
public ReadByte ( ) : int
return int

Seek() public method

When overridden in a derived class, sets the position within the current stream.
An I/O error occurs. /// The stream does not support seeking, such as if the stream is /// constructed from a pipe or console output. /// Methods were called after the stream was closed.
public Seek ( long offset, SeekOrigin origin ) : long
offset long A byte offset relative to the parameter.
origin SeekOrigin /// A value of type indicating the reference point used to /// obtain the new position. ///
return long

SetLength() public method

When overridden in a derived class, sets the length of the current stream.
An I/O error occurs. /// The stream does not support both writing and seeking, such as if the /// stream is constructed from a pipe or console output. /// Methods were called after the stream was closed.
public SetLength ( long value ) : void
value long The desired length of the current stream in bytes.
return void

Write() public method

When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
public Write ( byte buffer, int offset, int count ) : void
buffer byte /// An array of bytes. This method copies bytes from /// /// to the current stream. ///
offset int /// The zero-based byte offset in at which to begin copying bytes to the /// current stream. ///
count int The number of bytes to be written to the current stream.
return void

WriteAsync() public method

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.
public WriteAsync ( byte buffer, int offset, int count, CancellationToken cancellationToken ) : Task
buffer byte The buffer to write data from.
offset int /// The zero-based byte offset in from which to begin copying bytes to the /// stream. ///
count int The maximum number of bytes to write.
cancellationToken System.Threading.CancellationToken /// The token to monitor for cancellation requests. The default value is /// /// . ///
return Task

WriteByte() public method

Writes a byte to the current position in the stream and advances the position within the stream by one byte.
public WriteByte ( byte value ) : void
value byte The byte to write to the stream.
return void

this() public method

Gets or sets the System.Byte at the specified index.
public this ( long index ) : byte
index long The index.
return byte