BuildMaster SDK Reference
Version:

SlimMemoryStream Class

Stream backed by memory that is designed for minimal memory fragmentation.

Inheritance Hierarchy

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

Syntax

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

Constructors

Name Description
SlimMemoryStream

Initializes a new instance of the SlimMemoryStream class.

SlimMemoryStream(byte[] initialData, bool writable)

Initializes a new instance of the SlimMemoryStream class.

SlimMemoryStream(byte[] initialData, bool writable, bool copy)

Initializes a new instance of the SlimMemoryStream 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.

Capacity

Gets the current capacity of the SlimMemoryStream.

Length

Gets the length in bytes of the stream.

Position

Gets or sets the position within the current stream.

Methods

Name Description
CopyTo(System.IO.Stream destination)

Copies the contents of this stream starting from the current position to another stream.

CopyTo(byte[] buffer, int offset)

Copies all of the data in the SlimMemoryStream to a byte array.

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

Copies the contents of this stream starting from the current position to another stream.

Dispose(bool disposing)

Releases the unmanaged resources used by the SlimMemoryStream 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)

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

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)

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.

ToArray

Copies all of the data in the SlimMemoryStream to a byte array.

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)

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

WriteByte(byte value)

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