C# Class BKSystem.IO.BitStream

Creates a stream for reading and writing variable-length data.
Notes to Callers: Make sure to include the "BitStream.resx" resource file in projects using the BitStream class.



[20051201]: Fixed problem with public virtual void Write(ulong bits, int bitIndex, int count) and public virtual int Read(out ulong bits, int bitIndex, int count) methods.



[20051127]: Added public virtual void WriteTo(Stream bits); to write the contents of the current bit stream to another stream.



[20051125]: Added the following implicit operators to allow type casting instances of the BitStream class to and from other types of Stream objects:



public static implicit operator BitStream(MemoryStream bits);

public static implicit operator MemoryStream(BitStream bits);

public static implicit operator BitStream(FileStream bits);

public static implicit operator BitStream(BufferedStream bits);

public static implicit operator BufferedStream(BitStream bits);

public static implicit operator BitStream(NetworkStream bits);

public static implicit operator BitStream(CryptoStream bits);



[20051124]: Added public virtual byte [] ToByteArray(); method.



[20051124]: The public override int ReadByte(); and public override void WriteByte(byte value) method are now supported by the BitStream class.



[20051123]: Added public BitStream(Stream bits); contructor.



Inheritance: Stream
Exibir arquivo Open project: mattiasclaesson/TuningSuites Class Usage Examples

Public Methods

Method Description
And ( BitStream bits ) : BitStream

Performs a bitwise AND operation on the bits in the current stream against the corresponding bits in the specified stream.

.

BeginRead ( byte buffer, int offset, int count, AsyncCallback callback, object state ) : IAsyncResult

Begins an asynchronous read operation.

Notes to Callers: This method is not supported, and cannot be used. Asynchronous operations are not supported by the BitStream class.

BeginWrite ( byte buffer, int offset, int count, AsyncCallback callback, object state ) : IAsyncResult

Begins an asynchronous write operation.

Notes to Callers: This method is not supported, and cannot be used. Asynchronous operations are not supported by the BitStream class.

BitStream ( ) : System

Initialises a new instance of the BitStream class with an expandable capacity initialised to one.

.

BitStream ( Stream bits ) : System

Initialises a new instance of the BitStream class with the bits provided by the specified Stream.

Added [20051122].

BitStream ( long capacity ) : System

Initialises a new instance of the BitStream class with an expandable capacity initialised to the specified capacity in bits.

.

Close ( ) : void

Closes the current stream for reading and writing.

.

Copy ( ) : BitStream

Creates a copy of the current stream.

This method works even when the current stream is closed.

EndRead ( IAsyncResult asyncResult ) : int

Waits for the pending asynchronous read to complete.

Notes to Callers: This method is not supported, and cannot be used. Asynchronous operations are not supported by the BitStream class.

EndWrite ( IAsyncResult asyncResult ) : void

Ends an asynchronous write operation.

Notes to Callers: This method is not supported, and cannot be used. Asynchronous operations are not supported by the BitStream class.

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.

Notes to Callers: This method is not supported, and cannot be used.

GetBuffer ( ) : uint[]

Returns the array of unsigned integers from which this stream was created.

This method works even when the current stream is closed.

Not ( ) : BitStream

Performs a bitwise NOT operation on the bits in the current stream.

.

Or ( BitStream bits ) : BitStream

Performs a bitwise OR operation on the bits in the current stream against the corresponding bits in the specified stream.

.

Read ( bool &bit ) : int

Reads the bit contained in the current stream to a Boolean value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( bool bits, int offset, int count ) : int

Reads the bits contained in the current stream to a Boolean buffer.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( byte &bits ) : int

Reads the bits contained in the current stream to a Byte value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( byte &bits, int bitIndex, int count ) : int

Reads the bits contained in the current stream to a Byte value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( char &bits ) : int

Reads the bits contained in the current stream to a Char value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( char &bits, int bitIndex, int count ) : int

Reads the bits contained in the current stream to a Char value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( double &bits ) : int

Reads the bits contained in the current stream to a Double value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( double &bits, int bitIndex, int count ) : int

Reads the bits contained in the current stream to a Double value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( float &bits ) : int

Reads the bits contained in the current stream to a Single value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( float &bits, int bitIndex, int count ) : int

Reads the bits contained in the current stream to a Single value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( int &bits ) : int

Reads the bits contained in the current stream to a Int32 value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( int &bits, int bitIndex, int count ) : int

Reads the bits contained in the current stream to a Int32 value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( long &bits ) : int

Reads the bits contained in the current stream to a Int64 value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( long &bits, int bitIndex, int count ) : int

Reads the bits contained in the current stream to a Int64 value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( sbyte &bits ) : int

Reads the bits contained in the current stream to a SByte value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( sbyte &bits, int bitIndex, int count ) : int

Reads the bits contained in the current stream to a SByte value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( short &bits ) : int

Reads the bits contained in the current stream to a Int16 value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( short &bits, int bitIndex, int count ) : int

Reads the bits contained in the current stream to a Int16 value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( uint &bits ) : int

Reads the bits contained in the current stream to a UInt32 value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( uint &bits, int bitIndex, int count ) : int

Reads the bits contained in the current stream to a UInt32 value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( ulong &bits ) : int

Reads the bits contained in the current stream to a UInt64 value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.



Fixed [20051201].

Read ( ulong &bits, int bitIndex, int count ) : int

Reads the bits contained in the current stream to a UInt64 value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( ushort &bits ) : int

Reads the bits contained in the current stream to a UInt16 value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

Read ( ushort &bits, int bitIndex, int count ) : int

Reads the bits contained in the current stream to a UInt16 value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

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.

Modified [20051124]

Seek ( long offset, SeekOrigin origin ) : long

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

Notes to Callers: This method is not supported, and cannot be used. To set the position within the current stream use the Position property instead.

SetLength ( long value ) : void

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

Notes to Callers: This method is not supported, and cannot be used. All write operations at the end of the BitStream expand the BitStream automatically.

ShiftLeft ( long count ) : BitStream

Moves the bits of the current stream to the left by the specified number places.

.

ShiftRight ( long count ) : BitStream

Moves the bits of the current stream to the right by the specified number places.

.

ToByteArray ( ) : byte[]

Added [20051124].

ToString ( ) : string

Returns a String that represents the current stream in binary notation.

.

ToString ( bool bit ) : string

Returns a String that represents the specified value in binary notation.

.

ToString ( byte bits ) : string

Returns a String that represents the specified value in binary notation.

.

ToString ( char bits ) : string

Returns a String that represents the specified value in binary notation.

.

ToString ( double bits ) : string

Returns a String that represents the specified value in binary notation.

.

ToString ( float bits ) : string

Returns a String that represents the specified value in binary notation.

.

ToString ( int bits ) : string

Returns a String that represents the specified value in binary notation.

.

ToString ( long bits ) : string

Returns a String that represents the specified value in binary notation.

.

ToString ( sbyte bits ) : string

Returns a String that represents the specified value in binary notation.

.

ToString ( short bits ) : string

Returns a String that represents the specified value in binary notation.

.

ToString ( uint bits ) : string

Returns a String that represents the specified value in binary notation.

.

ToString ( ulong bits ) : string

Returns a String that represents the specified value in binary notation.

.

ToString ( ushort bits ) : string

Returns a String that represents the specified value in binary notation.

.

Write ( bool bit ) : void

Writes the bit represented by a Boolean value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( bool bits, int offset, int count ) : void

Writes the bits contained in a Boolean buffer to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( byte bits ) : void

Writes the bits contained in a Byte value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( byte bits, int bitIndex, int count ) : void

Writes the bits contained in a Byte value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( char bits ) : void

Writes the bits contained in a Char value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( char bits, int bitIndex, int count ) : void

Writes the bits contained in a Char value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( double bits ) : void

Writes the bits contained in a Double value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( double bits, int bitIndex, int count ) : void

Writes the bits contained in an Double value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( float bits ) : void

Writes the bits contained in a Single value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( float bits, int bitIndex, int count ) : void

Writes the bits contained in a Single value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( int bits ) : void

Writes the bits contained in an Int32 value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( int bits, int bitIndex, int count ) : void

Writes the bits contained in an Int32 value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( long bits ) : void

Writes the bits contained in an Int64 value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( long bits, int bitIndex, int count ) : void

Writes the bits contained in an UInt16 value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( sbyte bits ) : void

Writes the bits contained in an SByte value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( sbyte bits, int bitIndex, int count ) : void

Writes the bits contained in an SByte value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( short bits ) : void

Writes the bits contained in an Int16 value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( short bits, int bitIndex, int count ) : void

Writes the bits contained in an Int16 value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( uint bits ) : void

Writes the bits contained in an UInt32 value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( uint bits, int bitIndex, int count ) : void

Writes the bits contained in an UInt32 value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( ulong bits ) : void

Writes the bits contained in an UInt64 value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( ulong bits, int bitIndex, int count ) : void

Writes the bits contained in an UInt64 value to the current stream.

All write operations at the end of the BitStream expand the BitStream.



Fixed [20051201].

Write ( ushort bits ) : void

Writes the bits contained in an UInt16 value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Write ( ushort bits, int bitIndex, int count ) : void

Writes the bits contained in an UInt16 value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

WriteByte ( byte value ) : void

Writes a byte to the current stream at the current position.

All write operations at the end of the BitStream expand the BitStream.



Modified [20051124]

WriteTo ( Stream bits ) : void

Writes the entire contents of this bit stream to another stream.

Added [20051127]



All write operations at the end of the BitStream expand the BitStream.

Xor ( BitStream bits ) : BitStream

Performs a bitwise eXclusive OR operation on the bits in the current stream against the corresponding bits in the specified stream.

.

Private Methods

Method Description
ReDimPreserve ( uint buffer, uint newLength ) : uint[]

Re-dimensions and preserves the contents of a buffer by the specified amount.

.

Read ( uint &bits, uint &bitIndex, uint &count ) : uint

Reads the bits contained in the current stream to a UInt32 value.

The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.

UpdateIndicesForRead ( uint bits ) : void

Updates the internal buffer's bit indices after reading to the current stream by the specified number of bits.

.

UpdateIndicesForWrite ( uint bits ) : void

Updates the internal buffer's bit indices after writing to the current stream by the specified number of bits.

.

UpdateLengthForWrite ( uint bits ) : void

Updates the length of the internal buffer after wrinting to the current stream by the specified number of bits.

.

Write ( uint &bits, uint &bitIndex, uint &count ) : void

Writes the bits contained in an UInt32 value to the current stream.

All write operations at the end of the BitStream expand the BitStream.

Method Details

And() public method

Performs a bitwise AND operation on the bits in the current stream against the corresponding bits in the specified stream.
.
/// The current stream is closed. /// /// bits is a null reference (Nothing in Visual Basic). /// /// The stream specified by the bits parameter and the current /// stream do not have the same number of bits. ///
public And ( BitStream bits ) : BitStream
bits BitStream /// A object with which to perform the bitwise /// AND operation. ///
return BitStream

BeginRead() public method

Begins an asynchronous read operation.
Notes to Callers: This method is not supported, and cannot be used. Asynchronous operations are not supported by the BitStream class.
/// This method is not supported. ///
public BeginRead ( byte buffer, int offset, int count, AsyncCallback callback, object state ) : IAsyncResult
buffer byte /// The buffer to read the data into. ///
offset int /// The byte offset in buffer at which to begin writing data read /// from the stream. ///
count int /// The maximum number of bytes to read. ///
callback AsyncCallback /// An optional asynchronous callback, to be called when the read is /// complete. ///
state object /// A user-provided object that distinguishes this particular asynchronous /// read request from other requests. ///
return IAsyncResult

BeginWrite() public method

Begins an asynchronous write operation.
Notes to Callers: This method is not supported, and cannot be used. Asynchronous operations are not supported by the BitStream class.
/// This method is not supported. ///
public BeginWrite ( byte buffer, int offset, int count, AsyncCallback callback, object state ) : IAsyncResult
buffer byte /// The buffer to write data from. ///
offset int /// The byte offset in buffer from which to begin writing. ///
count int /// The maximum number of bytes to write. ///
callback AsyncCallback /// An optional asynchronous callback, to be called when the write is /// complete. ///
state object /// A user-provided object that distinguishes this particular asynchronous /// write request from other requests. ///
return IAsyncResult

BitStream() public method

Initialises a new instance of the BitStream class with an expandable capacity initialised to one.
.
public BitStream ( ) : System
return System

BitStream() public method

Initialises a new instance of the BitStream class with the bits provided by the specified Stream.
Added [20051122].
/// bits is a null reference (Nothing in Visual Basic). ///
public BitStream ( Stream bits ) : System
bits Stream /// A object containing the specified bits. ///
return System

BitStream() public method

Initialises a new instance of the BitStream class with an expandable capacity initialised to the specified capacity in bits.
.
/// capacity is negative or zero. ///
public BitStream ( long capacity ) : System
capacity long /// An specifying the initial size of the internal /// bit buffer in bits. ///
return System

Close() public method

Closes the current stream for reading and writing.
.
public Close ( ) : void
return void

Copy() public method

Creates a copy of the current stream.
This method works even when the current stream is closed.
public Copy ( ) : BitStream
return BitStream

EndRead() public method

Waits for the pending asynchronous read to complete.
Notes to Callers: This method is not supported, and cannot be used. Asynchronous operations are not supported by the BitStream class.
/// This method is not supported. ///
public EndRead ( IAsyncResult asyncResult ) : int
asyncResult IAsyncResult /// The reference to the pending asynchronous request to finish. ///
return int

EndWrite() public method

Ends an asynchronous write operation.
Notes to Callers: This method is not supported, and cannot be used. Asynchronous operations are not supported by the BitStream class.
/// This method is not supported. ///
public EndWrite ( IAsyncResult asyncResult ) : void
asyncResult IAsyncResult /// A reference to the outstanding asynchronous I/O request. ///
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.
Notes to Callers: This method is not supported, and cannot be used.
/// This method is not supported. Since any data written to a /// is written into RAM, this method is /// redundant. ///
public Flush ( ) : void
return void

GetBuffer() public method

Returns the array of unsigned integers from which this stream was created.
This method works even when the current stream is closed.
public GetBuffer ( ) : uint[]
return uint[]

Not() public method

Performs a bitwise NOT operation on the bits in the current stream.
.
/// The current stream is closed. ///
public Not ( ) : BitStream
return BitStream

Or() public method

Performs a bitwise OR operation on the bits in the current stream against the corresponding bits in the specified stream.
.
/// The current stream is closed. /// /// bits is a null reference (Nothing in Visual Basic). /// /// The stream specified by the bits parameter and the current /// stream do not have the same number of bits. ///
public Or ( BitStream bits ) : BitStream
bits BitStream /// A object with which to perform the bitwise /// OR operation. ///
return BitStream

Read() public method

Reads the bit contained in the current stream to a Boolean value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( bool &bit ) : int
bit bool /// When this method returns, contains the specified /// value with the bit between bitIndex and (bitIndex + count - 1) /// replaced by the bit read from the current stream. ///
return int

Read() public method

Reads the bits contained in the current stream to a Boolean buffer.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
/// The current stream is closed. /// /// bits is a null reference (Nothing in Visual Basic). /// /// offset or count is negative. /// /// offset subtracted from the buffer length is less than count. ///
public Read ( bool bits, int offset, int count ) : int
bits bool /// When this method returns, contains the specified /// array with the values between offset and (offset + count - 1) replaced /// by the bits read from the current stream. ///
offset int /// An value specifying the offset /// at which to begin reading. ///
count int /// An value specifying the maximum number of /// values to read. ///
return int

Read() public method

Reads the bits contained in the current stream to a Byte value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( byte &bits ) : int
bits byte /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
return int

Read() public method

Reads the bits contained in the current stream to a Byte value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
/// The current stream is closed. /// /// bitIndex or count is negative. /// /// bitIndex subtracted from the number of bits in a /// is less than count. ///
public Read ( byte &bits, int bitIndex, int count ) : int
bits byte /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
bitIndex int /// An value specifying the bit index at which to /// begin reading. ///
count int /// An value specifying the maximum number of bits /// to read. ///
return int

Read() public method

Reads the bits contained in the current stream to a Char value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( char &bits ) : int
bits char /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
return int

Read() public method

Reads the bits contained in the current stream to a Char value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
/// The current stream is closed. /// /// bitIndex or count is negative. /// /// bitIndex subtracted from the number of bits in a /// is less than count. ///
public Read ( char &bits, int bitIndex, int count ) : int
bits char /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
bitIndex int /// An value specifying the bit index at which to /// begin reading. ///
count int /// An value specifying the maximum number of bits /// to read. ///
return int

Read() public method

Reads the bits contained in the current stream to a Double value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( double &bits ) : int
bits double /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
return int

Read() public method

Reads the bits contained in the current stream to a Double value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( double &bits, int bitIndex, int count ) : int
bits double /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
bitIndex int /// An value specifying the bit index at which to /// begin reading. ///
count int /// An value specifying the maximum number of bits /// to read. ///
return int

Read() public method

Reads the bits contained in the current stream to a Single value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( float &bits ) : int
bits float /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
return int

Read() public method

Reads the bits contained in the current stream to a Single value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( float &bits, int bitIndex, int count ) : int
bits float /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
bitIndex int /// An value specifying the bit index at which to /// begin reading. ///
count int /// An value specifying the maximum number of bits /// to read. ///
return int

Read() public method

Reads the bits contained in the current stream to a Int32 value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( int &bits ) : int
bits int /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
return int

Read() public method

Reads the bits contained in the current stream to a Int32 value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( int &bits, int bitIndex, int count ) : int
bits int /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
bitIndex int /// An value specifying the bit index at which to /// begin reading. ///
count int /// An value specifying the maximum number of bits /// to read. ///
return int

Read() public method

Reads the bits contained in the current stream to a Int64 value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( long &bits ) : int
bits long /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
return int

Read() public method

Reads the bits contained in the current stream to a Int64 value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( long &bits, int bitIndex, int count ) : int
bits long /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
bitIndex int /// An value specifying the bit index at which to /// begin reading. ///
count int /// An value specifying the maximum number of bits /// to read. ///
return int

Read() public method

Reads the bits contained in the current stream to a SByte value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( sbyte &bits ) : int
bits sbyte /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
return int

Read() public method

Reads the bits contained in the current stream to a SByte value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( sbyte &bits, int bitIndex, int count ) : int
bits sbyte /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
bitIndex int /// An value specifying the bit index at which to /// begin reading. ///
count int /// An value specifying the maximum number of bits /// to read. ///
return int

Read() public method

Reads the bits contained in the current stream to a Int16 value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( short &bits ) : int
bits short /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
return int

Read() public method

Reads the bits contained in the current stream to a Int16 value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( short &bits, int bitIndex, int count ) : int
bits short /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
bitIndex int /// An value specifying the bit index at which to /// begin reading. ///
count int /// An value specifying the maximum number of bits /// to read. ///
return int

Read() public method

Reads the bits contained in the current stream to a UInt32 value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( uint &bits ) : int
bits uint /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
return int

Read() public method

Reads the bits contained in the current stream to a UInt32 value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
/// The current stream is closed. /// /// bitIndex or count is negative. /// /// bitIndex subtracted from the number of bits in a /// is less than count. ///
public Read ( uint &bits, int bitIndex, int count ) : int
bits uint /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
bitIndex int /// An value specifying the bit index at which to /// begin reading. ///
count int /// An value specifying the maximum number of bits /// to read. ///
return int

Read() public method

Reads the bits contained in the current stream to a UInt64 value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.



Fixed [20051201].
public Read ( ulong &bits ) : int
bits ulong /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
return int

Read() public method

Reads the bits contained in the current stream to a UInt64 value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
/// The current stream is closed. /// /// bitIndex or count is negative. /// /// bitIndex subtracted from the number of bits in a /// is less than count. ///
public Read ( ulong &bits, int bitIndex, int count ) : int
bits ulong /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
bitIndex int /// An value specifying the bit index at which to /// begin reading. ///
count int /// An value specifying the maximum number of bits /// to read. ///
return int

Read() public method

Reads the bits contained in the current stream to a UInt16 value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
public Read ( ushort &bits ) : int
bits ushort /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
return int

Read() public method

Reads the bits contained in the current stream to a UInt16 value.
The Read method returns zero if the end of the current stream is reached. In all other cases, Read always reads at least one bit from the current stream before returning.
/// The current stream is closed. /// /// bitIndex or count is negative. /// /// bitIndex subtracted from the number of bits in a /// is less than count. ///
public Read ( ushort &bits, int bitIndex, int count ) : int
bits ushort /// When this method returns, contains the specified /// value with the bits between bitIndex and (bitIndex + count - 1) /// replaced by the bits read from the current stream. ///
bitIndex int /// An value specifying the bit index at which to /// begin reading. ///
count int /// An value specifying the maximum number of bits /// to read. ///
return int

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

Seek() public method

When overridden in a derived class, sets the position within the current stream.
Notes to Callers: This method is not supported, and cannot be used. To set the position within the current stream use the Position property instead.
/// This method is not supported. ///
public Seek ( long offset, SeekOrigin origin ) : long
offset long /// A byte offset relative to the origin 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.
Notes to Callers: This method is not supported, and cannot be used. All write operations at the end of the BitStream expand the BitStream automatically.
/// This method is not supported. ///
public SetLength ( long value ) : void
value long /// The desired length of the current stream in bytes. ///
return void

ShiftLeft() public method

Moves the bits of the current stream to the left by the specified number places.
.
/// The current stream is closed. ///
public ShiftLeft ( long count ) : BitStream
count long /// An that represents the specified number of places. ///
return BitStream

ShiftRight() public method

Moves the bits of the current stream to the right by the specified number places.
.
/// The current stream is closed. ///
public ShiftRight ( long count ) : BitStream
count long /// An that represents the specified number of places. ///
return BitStream

ToByteArray() public method

Added [20051124].
public ToByteArray ( ) : byte[]
return byte[]

ToString() public method

Returns a String that represents the current stream in binary notation.
.
public ToString ( ) : string
return string

ToString() public static method

Returns a String that represents the specified value in binary notation.
.
public static ToString ( bool bit ) : string
bit bool /// A value representing the specified value. ///
return string

ToString() public static method

Returns a String that represents the specified value in binary notation.
.
public static ToString ( byte bits ) : string
bits byte /// A value representing the specified value. ///
return string

ToString() public static method

Returns a String that represents the specified value in binary notation.
.
public static ToString ( char bits ) : string
bits char /// A value representing the specified value. ///
return string

ToString() public static method

Returns a String that represents the specified value in binary notation.
.
public static ToString ( double bits ) : string
bits double /// A value representing the specified value. ///
return string

ToString() public static method

Returns a String that represents the specified value in binary notation.
.
public static ToString ( float bits ) : string
bits float /// A value representing the specified value. ///
return string

ToString() public static method

Returns a String that represents the specified value in binary notation.
.
public static ToString ( int bits ) : string
bits int /// A value representing the specified value. ///
return string

ToString() public static method

Returns a String that represents the specified value in binary notation.
.
public static ToString ( long bits ) : string
bits long /// A value representing the specified value. ///
return string

ToString() public static method

Returns a String that represents the specified value in binary notation.
.
public static ToString ( sbyte bits ) : string
bits sbyte /// A value representing the specified value. ///
return string

ToString() public static method

Returns a String that represents the specified value in binary notation.
.
public static ToString ( short bits ) : string
bits short /// A value representing the specified value. ///
return string

ToString() public static method

Returns a String that represents the specified value in binary notation.
.
public static ToString ( uint bits ) : string
bits uint /// A value representing the specified value. ///
return string

ToString() public static method

Returns a String that represents the specified value in binary notation.
.
public static ToString ( ulong bits ) : string
bits ulong /// A value representing the specified value. ///
return string

ToString() public static method

Returns a String that represents the specified value in binary notation.
.
public static ToString ( ushort bits ) : string
bits ushort /// A value representing the specified value. ///
return string

Write() public method

Writes the bit represented by a Boolean value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( bool bit ) : void
bit bool /// A value representing the bit to write data /// from. ///
return void

Write() public method

Writes the bits contained in a Boolean buffer to the current stream.
All write operations at the end of the BitStream expand the BitStream.
/// The current stream is closed. /// /// bits is a null reference (Nothing in Visual Basic). /// /// offset or count is negative. /// /// offset subtracted from the buffer length is less than count. ///
public Write ( bool bits, int offset, int count ) : void
bits bool /// A array specifying the buffer to write data from. ///
offset int /// An value specifying the /// offset to begin writing from. ///
count int /// An value specifying the maximum number of /// values to write. ///
return void

Write() public method

Writes the bits contained in a Byte value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( byte bits ) : void
bits byte /// A value specifying the bits to write data /// from. ///
return void

Write() public method

Writes the bits contained in a Byte value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
/// The current stream is closed. /// /// bitIndex or count is negative. /// /// bitIndex subtracted from the number of bits in a /// is less than count. ///
public Write ( byte bits, int bitIndex, int count ) : void
bits byte /// A value specifying the bits to write data /// from. ///
bitIndex int /// An value specifying the little-endian bit /// index to begin writing from. ///
count int /// An value specifying the maximum number of /// bits to write. ///
return void

Write() public method

Writes the bits contained in a Char value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( char bits ) : void
bits char /// An value specifying the bits to write data /// from. ///
return void

Write() public method

Writes the bits contained in a Char value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
/// The current stream is closed. /// /// bitIndex or count is negative. /// /// bitIndex subtracted from the number of bits in a /// is less than count. ///
public Write ( char bits, int bitIndex, int count ) : void
bits char /// An value specifying the bits to write data /// from. ///
bitIndex int /// An value specifying the little-endian bit /// index to begin writing from. ///
count int /// An value specifying the maximum number of /// bits to write. ///
return void

Write() public method

Writes the bits contained in a Double value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( double bits ) : void
bits double /// A value specifying the bits to write data /// from. ///
return void

Write() public method

Writes the bits contained in an Double value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( double bits, int bitIndex, int count ) : void
bits double /// A value specifying the bits to write data /// from. ///
bitIndex int /// An value specifying the little-endian bit /// index to begin writing from. ///
count int /// An value specifying the maximum number of /// bits to write. ///
return void

Write() public method

Writes the bits contained in a Single value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( float bits ) : void
bits float /// A value specifying the bits to write data /// from. ///
return void

Write() public method

Writes the bits contained in a Single value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( float bits, int bitIndex, int count ) : void
bits float /// An value specifying the bits to write data /// from. ///
bitIndex int /// An value specifying the little-endian bit /// index to begin writing from. ///
count int /// An value specifying the maximum number of /// bits to write. ///
return void

Write() public method

Writes the bits contained in an Int32 value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( int bits ) : void
bits int /// An value specifying the bits to write data /// from. ///
return void

Write() public method

Writes the bits contained in an Int32 value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( int bits, int bitIndex, int count ) : void
bits int /// An value specifying the bits to write data /// from. ///
bitIndex int /// An value specifying the little-endian bit /// index to begin writing from. ///
count int /// An value specifying the maximum number of /// bits to write. ///
return void

Write() public method

Writes the bits contained in an Int64 value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( long bits ) : void
bits long /// An value specifying the bits to write data /// from. ///
return void

Write() public method

Writes the bits contained in an UInt16 value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( long bits, int bitIndex, int count ) : void
bits long /// An value specifying the bits to write data /// from. ///
bitIndex int /// An value specifying the little-endian bit /// index to begin writing from. ///
count int /// An value specifying the maximum number of /// bits to write. ///
return void

Write() public method

Writes the bits contained in an SByte value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( sbyte bits ) : void
bits sbyte /// An value specifying the bits to write data /// from. ///
return void

Write() public method

Writes the bits contained in an SByte value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( sbyte bits, int bitIndex, int count ) : void
bits sbyte /// An value specifying the bits to write data /// from. ///
bitIndex int /// An value specifying the little-endian bit /// index to begin writing from. ///
count int /// An value specifying the maximum number of /// bits to write. ///
return void

Write() public method

Writes the bits contained in an Int16 value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( short bits ) : void
bits short /// An value specifying the bits to write data /// from. ///
return void

Write() public method

Writes the bits contained in an Int16 value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( short bits, int bitIndex, int count ) : void
bits short /// An value specifying the bits to write data /// from. ///
bitIndex int /// An value specifying the little-endian bit /// index to begin writing from. ///
count int /// An value specifying the maximum number of /// bits to write. ///
return void

Write() public method

Writes the bits contained in an UInt32 value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( uint bits ) : void
bits uint /// An value specifying the bits to write data /// from. ///
return void

Write() public method

Writes the bits contained in an UInt32 value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
/// The current stream is closed. /// /// bitIndex or count is negative. /// /// bitIndex subtracted from the number of bits in a /// is less than count. ///
public Write ( uint bits, int bitIndex, int count ) : void
bits uint /// An value specifying the bits to write data /// from. ///
bitIndex int /// An value specifying the little-endian bit /// index to begin writing from. ///
count int /// An value specifying the maximum number of /// bits to write. ///
return void

Write() public method

Writes the bits contained in an UInt64 value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( ulong bits ) : void
bits ulong /// An value specifying the bits to write data /// from. ///
return void

Write() public method

Writes the bits contained in an UInt64 value to the current stream.
All write operations at the end of the BitStream expand the BitStream.



Fixed [20051201].
/// The current stream is closed. /// /// bitIndex or count is negative. /// /// bitIndex subtracted from the number of bits in a /// is less than count. ///
public Write ( ulong bits, int bitIndex, int count ) : void
bits ulong /// An value specifying the bits to write data /// from. ///
bitIndex int /// An value specifying the little-endian bit /// index to begin writing from. ///
count int /// An value specifying the maximum number of /// bits to write. ///
return void

Write() public method

Writes the bits contained in an UInt16 value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
public Write ( ushort bits ) : void
bits ushort /// An value specifying the bits to write data /// from. ///
return void

Write() public method

Writes the bits contained in an UInt16 value to the current stream.
All write operations at the end of the BitStream expand the BitStream.
/// The current stream is closed. /// /// bitIndex or count is negative. /// /// bitIndex subtracted from the number of bits in a /// is less than count. ///
public Write ( ushort bits, int bitIndex, int count ) : void
bits ushort /// An value specifying the bits to write data /// from. ///
bitIndex int /// An value specifying the little-endian bit /// index to begin writing from. ///
count int /// An value specifying the maximum number of /// bits to write. ///
return void

WriteByte() public method

Writes a byte to the current stream at the current position.
All write operations at the end of the BitStream expand the BitStream.



Modified [20051124]
public WriteByte ( byte value ) : void
value byte /// The byte to write. ///
return void

WriteTo() public method

Writes the entire contents of this bit stream to another stream.
Added [20051127]



All write operations at the end of the BitStream expand the BitStream.
/// The current stream is closed. /// /// bits is a null reference (Nothing in Visual Basic). ///
public WriteTo ( Stream bits ) : void
bits Stream /// A object specifying the stream to write this /// bit stream to. ///
return void

Xor() public method

Performs a bitwise eXclusive OR operation on the bits in the current stream against the corresponding bits in the specified stream.
.
/// The current stream is closed. /// /// bits is a null reference (Nothing in Visual Basic). /// /// The stream specified by the bits parameter and the current /// stream do not have the same number of bits. ///
public Xor ( BitStream bits ) : BitStream
bits BitStream /// A object with which to perform the bitwise /// eXclusive OR operation. ///
return BitStream