UK_CO_MEVANSPN_libBitStream.BitStreamWriter Class Reference

Objects derived from this class are used to write data of arbitrary length to a stream whose data can later be retrieved as a memory-resident byte array or can be written directly to file on writable storage media. More...

List of all members.

Public Member Functions

 BitStreamWriter ()
 Creates a BitStreamWriter using the default sub-storage block size of 4096 bytes. This constructor is meant for general purpose usage but may be less efficient than the secondary constructor which allows the sub-storage block size to be user-defined, allowing for larger blocks more suited for efficient storage with larger data storage requirements.
 BitStreamWriter (int _block_size)
 Createa a BitStreamWriter object with a user-defined sub-block storage size (in bytes) Larger sub-blocks will make the storage routines more efficient whilst small sub-blocks are suitable for compact data management where memory is limited. The default constructor uses a sub-block size of 4096 bytes.
void write (byte _value, int _req_bits)
 Writes a byte value to the BitStreamWriter storage, fitting it into the required number of bits. If the value is too large to fit into the required number of bits or the required bit-length is less than 1 or greater that 8 then a BitRequirementException is thrown.
void writeBytes (byte[] _bytes)
 Writes an array of bytes to storage using the default bit length of 8-bits per byte.
void write (char _value)
 Writes a char value to storage.
void write (short _value)
 Writes an chort value to storage.
void write (ushort _value)
 Writes an unsigned short value to storage.
void write (int _value)
 Writes an integer value to storage.
void write (uint _value)
 Writes an unsigned integer value to storage.
void write (float _value)
 Writes a float value to storage.
void write (double _value)
 Writes a double precision float value to storage.
void write (string _value)
 Writes a string to storage. Note that the string is stored as an array of char values, not bytes.
byte[] getBytes ()
 Returns the stored values as a byte array.
void saveToFile (string _filename)
 Saves the stored data directly to file. If the filename given points to an inaccessible storage location an exception will be thrown.

Static Public Member Functions

static int getBitCount (byte _value)
 Utility method: Returns the minimum number of bits required to store a byte value.

Static Public Attributes

static readonly byte[] max_bit_values
 Utility membe: Defines an array of values representing the maximum value storable in a particular bit length.


Detailed Description

Objects derived from this class are used to write data of arbitrary length to a stream whose data can later be retrieved as a memory-resident byte array or can be written directly to file on writable storage media.


Constructor & Destructor Documentation

UK_CO_MEVANSPN_libBitStream.BitStreamWriter.BitStreamWriter (  ) 

Creates a BitStreamWriter using the default sub-storage block size of 4096 bytes. This constructor is meant for general purpose usage but may be less efficient than the secondary constructor which allows the sub-storage block size to be user-defined, allowing for larger blocks more suited for efficient storage with larger data storage requirements.

UK_CO_MEVANSPN_libBitStream.BitStreamWriter.BitStreamWriter ( int  _block_size  ) 

Createa a BitStreamWriter object with a user-defined sub-block storage size (in bytes) Larger sub-blocks will make the storage routines more efficient whilst small sub-blocks are suitable for compact data management where memory is limited. The default constructor uses a sub-block size of 4096 bytes.

Parameters:
_block_size Size of the sub-block storage in bytes. A System.Int32


Member Function Documentation

void UK_CO_MEVANSPN_libBitStream.BitStreamWriter.write ( byte  _value,
int  _req_bits 
)

Writes a byte value to the BitStreamWriter storage, fitting it into the required number of bits. If the value is too large to fit into the required number of bits or the required bit-length is less than 1 or greater that 8 then a BitRequirementException is thrown.

Parameters:
_value The value to write to storage. A System.Byte
The number of bits to use to store the value.
Parameters:
_req_bits A System.Int32

void UK_CO_MEVANSPN_libBitStream.BitStreamWriter.writeBytes ( byte[]  _bytes  ) 

Writes an array of bytes to storage using the default bit length of 8-bits per byte.

Parameters:
_bytes The byte array to write to storage. A System.Byte

void UK_CO_MEVANSPN_libBitStream.BitStreamWriter.write ( char  _value  ) 

Writes a char value to storage.

Parameters:
_value Char value to write. A System.Char

void UK_CO_MEVANSPN_libBitStream.BitStreamWriter.write ( short  _value  ) 

Writes an chort value to storage.

Parameters:
_value Short value to write. A System.Int16

void UK_CO_MEVANSPN_libBitStream.BitStreamWriter.write ( ushort  _value  ) 

Writes an unsigned short value to storage.

Parameters:
_value Value to write. A System.UInt16

void UK_CO_MEVANSPN_libBitStream.BitStreamWriter.write ( int  _value  ) 

Writes an integer value to storage.

Parameters:
_value Value to write. A System.Int32

void UK_CO_MEVANSPN_libBitStream.BitStreamWriter.write ( uint  _value  ) 

Writes an unsigned integer value to storage.

Parameters:
_value Value to write. A System.UInt32

void UK_CO_MEVANSPN_libBitStream.BitStreamWriter.write ( float  _value  ) 

Writes a float value to storage.

Parameters:
_value Write to write. A System.Single

void UK_CO_MEVANSPN_libBitStream.BitStreamWriter.write ( double  _value  ) 

Writes a double precision float value to storage.

Parameters:
_value Value to write. A System.Double

void UK_CO_MEVANSPN_libBitStream.BitStreamWriter.write ( string  _value  ) 

Writes a string to storage. Note that the string is stored as an array of char values, not bytes.

Parameters:
_value String to write. A System.String

byte [] UK_CO_MEVANSPN_libBitStream.BitStreamWriter.getBytes (  ) 

Returns the stored values as a byte array.

Returns:
An array of bytes representing the stored data. A System.Byte

void UK_CO_MEVANSPN_libBitStream.BitStreamWriter.saveToFile ( string  _filename  ) 

Saves the stored data directly to file. If the filename given points to an inaccessible storage location an exception will be thrown.

Parameters:
_filename Filename (including optional path) used to store this data. A System.String

static int UK_CO_MEVANSPN_libBitStream.BitStreamWriter.getBitCount ( byte  _value  )  [static]

Utility method: Returns the minimum number of bits required to store a byte value.

Parameters:
_value Value to store. A System.Byte
Returns:
Minimum number of bits required to store the value. A System.Int32


Member Data Documentation

Utility membe: Defines an array of values representing the maximum value storable in a particular bit length.


The documentation for this class was generated from the following file:

Generated on Fri Feb 20 12:38:23 2009 for libBitStreamDoc by  doxygen 1.5.6