C# Class GSF.IO.Compression.PatternDecompressor

Defines functions for decompression of data compressed by the PatternCompressor.
ファイルを表示 Open project: GridProtectionAlliance/gsf Class Usage Examples

Public Methods

Method Description
AugmentBuffer ( byte data ) : void

Inserts the given data into the data buffer for decompression.

AugmentBuffer ( byte data, int dataLength ) : void

Inserts the given data into the data buffer for decompression.

AugmentBuffer ( byte data, int offset, int dataLength ) : void

Inserts the given data into the data buffer for decompression.

Decompress ( byte buffer ) : void

Decompresses enough bytes of data to fill up the buffer.

Decompress ( byte buffer, int length ) : void

Decompresses length bytes of data and places it in the buffer.

Decompress ( byte buffer, int offset, int length ) : void

Decompresses length bytes of data and places it in the buffer starting at offset.

Decompress ( double &value ) : void

Decompresses eight bytes of data and writes the data into a 64-bit floating point number.

Decompress ( float &value ) : void

Decompresses four bytes of data and writes the data into a 32-bit floating point number.

Decompress ( int &value ) : void

Decompresses four bytes of data and writes the data into a 32-bit signed integer.

Decompress ( long &value ) : void

Decompresses eight bytes of data and writes the data into a 64-bit signed integer.

Decompress ( short &value ) : void

Decompresses four bytes of data and writes the data into a 16-bit signed integer. The high-order bytes are discarded.

Decompress ( uint &value ) : void

Decompresses four bytes of data and writes the data into a 32-bit unsigned integer.

Decompress ( ulong &value ) : void

Decompresses eight bytes of data and writes the data into a 64-bit unsigned integer.

Decompress ( ushort &value ) : void

Decompresses four bytes of data and writes the data into a 16-bit unsigned integer. The high-order bytes are discarded.

DecompressBuffer ( byte source, int startIndex, int dataLength, int bufferLength ) : int

Decompress a byte array containing a sequential list of compressed 32-bit structures (e.g., floating point numbers, integers or unsigned integers) using a patterned compression method.

Decompression is performed inline. The source buffer must be large enough to contain the maximum possible size of the decompressed buffer. This maximum size can be obtained by using the MaximumSizeDecompressed method.

As an optimization this function is using pointers to native structures, as such the endian order decoding and encoding of the values will always be in the native endian order of the operating system.

EmptyBuffer ( ) : void

Clears out the data buffer so that subsequent calls to the Decompress methods do not use the data that was previously in the data buffer.

This method should not be called during normal operation, as data will be lost and the compressed stream will likely be corrupted. Only call this method if the stream has already been corrupted.

MaximumSizeDecompressed ( int compressedLength ) : int

Given the size of a compressed buffer, provides the maximum possible size of the decompressed data.

Reset ( ) : void

Resets the decompressor by flushing the back buffer. Subsequent calls to the Decompress methods will not be decompressed using previously decompressed values.

Private Methods

Method Description
DecompressValue ( ) : uint
GetDecompressedValue ( ) : uint
GetFirstValue ( ) : uint
InsertIntoBackBuffer ( uint value ) : void

Method Details

AugmentBuffer() public method

Inserts the given data into the data buffer for decompression.
public AugmentBuffer ( byte data ) : void
data byte The data to be inserted into the data buffer.
return void

AugmentBuffer() public method

Inserts the given data into the data buffer for decompression.
public AugmentBuffer ( byte data, int dataLength ) : void
data byte The data to be inserted into the data buffer.
dataLength int The amount of data to be taken from the given buffer and placed in the data buffer.
return void

AugmentBuffer() public method

Inserts the given data into the data buffer for decompression.
public AugmentBuffer ( byte data, int offset, int dataLength ) : void
data byte The data to be inserted into the data buffer.
offset int The amount of data to be ignored at the beginning of the buffer.
dataLength int The amount of data to be taken from the given buffer and placed in the data buffer.
return void

Decompress() public method

Decompresses enough bytes of data to fill up the buffer.
cannot be null. length must be a multiple of four.
public Decompress ( byte buffer ) : void
buffer byte The buffer that holds the data.
return void

Decompress() public method

Decompresses length bytes of data and places it in the buffer.
cannot be null. must be a multiple of four. must be greater than or equal to zero. exceeds array boundaries.
public Decompress ( byte buffer, int length ) : void
buffer byte The buffer that holds the data.
length int The amount of data to be decompressed and written to the buffer. The value of this parameter must be a multiple of four.
return void

Decompress() public method

Decompresses length bytes of data and places it in the buffer starting at offset.
cannot be null. must be a multiple of four. must be greater than or equal to zero. must be greater than or equal to zero. exceeds array boundaries.
public Decompress ( byte buffer, int offset, int length ) : void
buffer byte The buffer that holds the data.
offset int The amount of data at the beginning of the buffer that will not be overwritten.
length int The amount of data to be decompressed and written to the buffer. The value of this parameter must be a multiple of four.
return void

Decompress() public method

Decompresses eight bytes of data and writes the data into a 64-bit floating point number.
public Decompress ( double &value ) : void
value double The 64-bit floating point number that the data is to be written to.
return void

Decompress() public method

Decompresses four bytes of data and writes the data into a 32-bit floating point number.
public Decompress ( float &value ) : void
value float The 32-bit floating point number that the data is to be written to.
return void

Decompress() public method

Decompresses four bytes of data and writes the data into a 32-bit signed integer.
public Decompress ( int &value ) : void
value int The 32-bit integer that the data is to be written to.
return void

Decompress() public method

Decompresses eight bytes of data and writes the data into a 64-bit signed integer.
public Decompress ( long &value ) : void
value long The 64-bit integer that the data is to be written to.
return void

Decompress() public method

Decompresses four bytes of data and writes the data into a 16-bit signed integer. The high-order bytes are discarded.
public Decompress ( short &value ) : void
value short The 16-bit integer that the data is to be written to.
return void

Decompress() public method

Decompresses four bytes of data and writes the data into a 32-bit unsigned integer.
public Decompress ( uint &value ) : void
value uint The 32-bit integer that the data is to be written to.
return void

Decompress() public method

Decompresses eight bytes of data and writes the data into a 64-bit unsigned integer.
public Decompress ( ulong &value ) : void
value ulong The 64-bit integer that the data is to be written to.
return void

Decompress() public method

Decompresses four bytes of data and writes the data into a 16-bit unsigned integer. The high-order bytes are discarded.
public Decompress ( ushort &value ) : void
value ushort The 16-bit integer that the data is to be written to.
return void

DecompressBuffer() public static method

Decompress a byte array containing a sequential list of compressed 32-bit structures (e.g., floating point numbers, integers or unsigned integers) using a patterned compression method.

Decompression is performed inline. The source buffer must be large enough to contain the maximum possible size of the decompressed buffer. This maximum size can be obtained by using the MaximumSizeDecompressed method.

As an optimization this function is using pointers to native structures, as such the endian order decoding and encoding of the values will always be in the native endian order of the operating system.

buffer cannot be null. must be greater than or equal to one. must be at least as large as . must be at least as large as is necessary to fit the maximum possible size of the decompressed data. Actual length of buffer is less than specified .
public static DecompressBuffer ( byte source, int startIndex, int dataLength, int bufferLength ) : int
source byte The array containing compressed 32-bit values to be decompressed. Decompression will happen inline on this buffer.
startIndex int An representing the start index of the byte array.
dataLength int The number of bytes in the buffer that represents actual data.
bufferLength int The number of bytes available for use in the buffer; actual buffer length must be at least large enough to fit the maximum size of the decompressed data. See .
return int

EmptyBuffer() public method

Clears out the data buffer so that subsequent calls to the Decompress methods do not use the data that was previously in the data buffer.
This method should not be called during normal operation, as data will be lost and the compressed stream will likely be corrupted. Only call this method if the stream has already been corrupted.
public EmptyBuffer ( ) : void
return void

MaximumSizeDecompressed() public static method

Given the size of a compressed buffer, provides the maximum possible size of the decompressed data.
public static MaximumSizeDecompressed ( int compressedLength ) : int
compressedLength int Size of the compressed buffer.
return int

Reset() public method

Resets the decompressor by flushing the back buffer. Subsequent calls to the Decompress methods will not be decompressed using previously decompressed values.
public Reset ( ) : void
return void