Class CompressorHuffmanTree
Represents the Huffman Tree.
Inheritance
System.Object
CompressorHuffmanTree
Namespace: Syncfusion.Compression
Assembly: Syncfusion.DocIO.UWP.dll
Syntax
public class CompressorHuffmanTree : Object
Constructors
CompressorHuffmanTree(CompressedStreamWriter, Int32, Int32, Int32)
Create a new Huffman tree
Declaration
public CompressorHuffmanTree(CompressedStreamWriter writer, int iElementsCount, int iMinimumCodes, int iMaximumLength)
Parameters
Type | Name | Description |
---|---|---|
CompressedStreamWriter | writer | |
System.Int32 | iElementsCount | |
System.Int32 | iMinimumCodes | |
System.Int32 | iMaximumLength |
Properties
CodeFrequences
Code frequences.
Declaration
public short[] CodeFrequences { get; }
Property Value
Type |
---|
System.Int16[] |
CodeLengths
Lengths of codes in tree.
Declaration
public byte[] CodeLengths { get; }
Property Value
Type |
---|
System.Byte[] |
TreeLength
Length of the tree.
Declaration
public int TreeLength { get; }
Property Value
Type |
---|
System.Int32 |
Methods
BuildCodes()
Calculates codes from their frequences.
Declaration
public void BuildCodes()
BuildTree()
Builds tree.
Declaration
public void BuildTree()
CalcBLFreq(CompressorHuffmanTree)
Calculates code frequences.
Declaration
public void CalcBLFreq(CompressorHuffmanTree blTree)
Parameters
Type | Name | Description |
---|---|---|
CompressorHuffmanTree | blTree | Tree. |
CheckEmpty()
Checks wheather tree is empty. If tree is not empty, then exception will be raised.
Declaration
public void CheckEmpty()
GetEncodedLength()
Calculates length of the compressed data.
Declaration
public int GetEncodedLength()
Returns
Type | Description |
---|---|
System.Int32 | Count of bits, the data will occupy. |
Reset()
Resets all code data in tree.
Declaration
public void Reset()
SetStaticCodes(Int16[], Byte[])
Specifies new arrays of codes and their lengths.
Declaration
public void SetStaticCodes(short[] codes, byte[] lengths)
Parameters
Type | Name | Description |
---|---|---|
System.Int16[] | codes | Array of codes. |
System.Byte[] | lengths | Array of code lengths. |
WriteCodeToStream(Int32)
Writes code to the compressor output stream.
Declaration
public void WriteCodeToStream(int code)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | code | Code to be written. |
WriteTree(CompressorHuffmanTree)
Writes tree to output stream.
Declaration
public void WriteTree(CompressorHuffmanTree blTree)
Parameters
Type | Name | Description |
---|---|---|
CompressorHuffmanTree | blTree | Tree to be written. |