| title | BitStream |
|---|---|
| name | BitStream |
| permalink | /api/bit-stream/ |
A stream that can be used at the bit level
Whether or not the stream will grow the buffer to accomodate more data.
Wheter or not or there is any data to be read from the stream.
Whether or not this stream can accept new data. NOTE: this will return true even if only fewer than 8 bits can be written!
Current buffer size. The buffer will not be resized (if possible) until Position is equal to Capacity and an attempt to write data is made.
The current length of data considered to be "written" to the buffer.
The index that will be written to when any call to write data is made to this stream.
Bit offset into the buffer that new data will be written to.
Length of data (in bits) that is considered to be written to the stream.
A stream that supports writing data smaller than a single byte. This stream also has a built-in compression algorithm that can (optionally) be used to write compressed data.
``int`` capacity
Initial capacity of buffer in bytes.
``float`` growthFactor
Factor by which buffer should grow when necessary.
A stream that supports writing data smaller than a single byte. This stream also has a built-in compression algorithm that can (optionally) be used to write compressed data.
``float`` growthFactor
Factor by which buffer should grow when necessary.
A stream that supports writing data smaller than a single byte. This stream also has a built-in compression algorithm that can (optionally) be used to write compressed data.
``int`` capacity
A stream that supports writing data smaller than a single byte. This stream also has a built-in compression algorithm that can (optionally) be used to write compressed data.
A stream that supports writing data smaller than a single byte. This stream also has a built-in compression algorithm that can (optionally) be used to write compressed data. NOTE: when using a pre-allocated buffer, the stream will not grow!
``byte[]`` target
Pre-allocated buffer to write to
Flush stream. This does nothing since data is written directly to a byte buffer.
Read a byte from the buffer. This takes into account possible byte misalignment.
A byte from the buffer or, if a byte can't be read, -1.
Peeks a byte without advancing the position
The peeked byte
Read a single bit from the stream.
A bit in bool format. (True represents 1, False represents 0)
Read a subset of the stream buffer and write the contents to the supplied buffer.
``byte[]`` buffer
Buffer to copy data to.
``int`` offset
Offset into the buffer to write data to.
``int`` count
How many bytes to attempt to read.
Amount of bytes read.
Set position in stream to read from/write to.
``long`` offset
Offset from position origin.
``SeekOrigin`` origin
How to calculate offset.
The new position in the buffer that data will be written to.
Set length of data considered to be "written" to the stream.
``long`` value
New length of the written data.
Write data from the given buffer to the internal stream buffer.
``byte[]`` buffer
Buffer to write from.
``int`` offset
Offset in given buffer to start reading from.
``int`` count
Amount of bytes to read copy from given buffer to stream buffer.
Write data from the given buffer to the internal stream buffer.
``byte[]`` buffer
Buffer to write from.
Write a single bit to the stream
``bool`` bit
Value of the bit. True represents 1, False represents 0
Copy data from another stream
``Stream`` s
Stream to copy from
``int`` count
How many bytes to read. Set to value less than one to read until ReadByte returns -1
Copies urnead bytes from the source stream
``Stream`` s
The source stream to copy from
``int`` count
The max amount of bytes to copy
public ``void`` CopyFrom([``BitStream``](/MLAPI/api/bit-stream/) stream, ``int`` dataCount, ``bool`` copyBits);
Copys the bits from the provided BitStream
[``BitStream``](/MLAPI/api/bit-stream/) stream
The stream to copy from
``int`` dataCount
The amount of data evel
``bool`` copyBits
Wheter or not to copy at the bit level rather than the byte level
Get the internal buffer being written to by this stream.
Creates a copy of the internal buffer. This only contains the used bytes
A copy of used bytes in the internal buffer
Returns hex encoded version of the buffer
Hex encoded version of the buffer
``Stream`` destination
``Stream`` destination
``int`` bufferSize
public ``Task`` CopyToAsync(``Stream`` destination, ``int`` bufferSize, ``CancellationToken`` cancellationToken);
``Stream`` destination
``int`` bufferSize
``CancellationToken`` cancellationToken
``Stream`` destination
``Stream`` destination
``int`` bufferSize
``CancellationToken`` cancellationToken
public ``IAsyncResult`` BeginRead(``byte[]`` buffer, ``int`` offset, ``int`` count, ``AsyncCallback`` callback, ``object`` state);
``byte[]`` buffer
``int`` offset
``int`` count
``AsyncCallback`` callback
``object`` state
``IAsyncResult`` asyncResult
``byte[]`` buffer
``int`` offset
``int`` count
public ``Task`` ReadAsync(``byte[]`` buffer, ``int`` offset, ``int`` count, ``CancellationToken`` cancellationToken);
``byte[]`` buffer
``int`` offset
``int`` count
``CancellationToken`` cancellationToken
public ``IAsyncResult`` BeginWrite(``byte[]`` buffer, ``int`` offset, ``int`` count, ``AsyncCallback`` callback, ``object`` state);
``byte[]`` buffer
``int`` offset
``int`` count
``AsyncCallback`` callback
``object`` state
``IAsyncResult`` asyncResult
``byte[]`` buffer
``int`` offset
``int`` count
public ``Task`` WriteAsync(``byte[]`` buffer, ``int`` offset, ``int`` count, ``CancellationToken`` cancellationToken);
``byte[]`` buffer
``int`` offset
``int`` count
``CancellationToken`` cancellationToken
``Span`` destination
``ReadOnlySpan`` source
``Memory`` destination
``CancellationToken`` cancellationToken
public ``ValueTask`` WriteAsync(``ReadOnlyMemory`` source, ``CancellationToken`` cancellationToken);
``ReadOnlyMemory`` source
``CancellationToken`` cancellationToken
``Type`` requestedType