@syncfusion/ej2-pdf
Version:
Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.
297 lines (296 loc) • 6.81 kB
TypeScript
import { _InflaterState, _BlockType } from './enum';
import { _DecompressedOutput } from './decompressed-output';
import { _InBuffer } from './in-buffer';
import { _HuffmanTree } from './huffman-tree';
/**
* Implements a deflate decompressor with bitwise parsing and Huffman decoding.
*
* @private
*/
export declare class _Inflater {
constructor();
/**
* Output buffer manager for decompressed data.
*
* @private
*/
_output: _DecompressedOutput;
/**
* Input buffer manager for reading compressed bits.
*
* @private
*/
_input: _InBuffer;
/**
* Huffman tree for literal/length codes.
*
* @private
*/
_llTree: _HuffmanTree;
/**
* Huffman tree for distance codes.
*
* @private
*/
_distanceTree: _HuffmanTree;
/**
* Current state of the inflater state machine.
*
* @private
*/
_inflaterState: _InflaterState;
/**
* Indicates whether this is the final block of the stream.
*
* @private
*/
_bfinal: number;
/**
* Type of the current block being processed.
*
* @private
*/
_blockType: _BlockType;
/**
* Temporary buffer for reading block header bits.
*
* @private
*/
_blBuffer: number[];
/**
* Number of valid bits currently held in the block header buffer.
*
* @private
*/
_bLength: number;
/**
* Current match length during decoding.
*
* @private
*/
_length: number;
/**
* Current distance code value during decoding.
*
* @private
*/
_distanceCode: number;
/**
* Additional bits required for the current code.
*
* @private
*/
_extraBits: number;
/**
* General purpose loop counter used during parsing.
*
* @private
*/
_loopCounter: number;
/**
* Number of literal/length codes in the dynamic block.
*
* @private
*/
_llCodeCount: number;
/**
* Number of distance codes in the dynamic block.
*
* @private
*/
_dCodeCount: number;
/**
* Number of code length codes in the dynamic block.
*
* @private
*/
_clCodeCount: number;
/**
* Size of the code array for building Huffman trees.
*
* @private
*/
_caSize: number;
/**
* Current literal/length code value.
*
* @private
*/
_lengthCode: number;
/**
* Buffer holding code values for building trees.
*
* @private
*/
_codeList: number[];
/**
* Temporary array for code length code values.
*
* @private
*/
_cltcl: number[];
/**
* Huffman tree for code length codes.
*
* @private
*/
_clTree: _HuffmanTree;
/**
* Extra bits required for each length code.
*
* @private
*/
_extraLengthBits: number[];
/**
* Precomputed lookup table for static distance Huffman codes.
*
* @private
*/
_staticDistanceTreeTable: number[];
/**
* Base lengths corresponding to each length code.
*
* @private
*/
_lengthBase: number[];
/**
* Base distances and positions for distance codes.
*
* @private
*/
_distanceBasePosition: number[];
/**
* Ordering of code length code indices used during tree construction.
*
* @private
*/
_codeOrder: number[];
/**
* Indicates whether the decompressor has reached the final block or completed state.
*
* @private
*/
readonly _finished: boolean;
/**
* Sets the input byte range for the decompressor to read from.
*
* @private
*/
_setInput(inputBytes: number[], offset: number, length: number): void;
/**
* Produces decompressed bytes into the target array until the request is satisfied or input ends.
*
* @private
*/
_inflate(bytes: number[], offset: number, length: number): {
count: number;
data: number[];
};
/**
* Advances the state machine to process the next block or symbols and reports progress.
*
* @private
*/
_decode(): boolean;
/**
* Processes an uncompressed block and copies bytes directly into the output buffer.
*
* @private
*/
_decodeUncompressedBlock(endBlock: boolean): {
result: boolean;
eob: boolean;
output: _DecompressedOutput;
};
/**
* Reads the next header byte for an uncompressed block and updates length fields.
*
* @private
*/
_unCompressedByte(): boolean;
/**
* Decodes a compressed block using literal length and distance trees and writes to the output.
*
* @private
*/
_decodeBlock(endBlock: boolean): {
result: boolean;
eob: boolean;
output: _DecompressedOutput;
};
/**
* Reads any extra length bits and prepares for distance decoding.
*
* @private
*/
_inLength(fb: number): {
value: boolean;
fb: number;
};
/**
* Resolves the distance code and prepares for back reference copying.
*
* @private
*/
_fLength(fb: number): {
value: boolean;
fb: number;
};
/**
* Computes the match offset and copies the match into the output buffer.
*
* @private
*/
_dcode(fb: number): {
value: boolean;
fb: number;
};
/**
* Reads dynamic header tables and builds the length and distance trees.
*
* @private
*/
_decodeDynamicBlockHeader(): boolean;
/**
* Reads the distance code count and proceeds to read code length counts.
*
* @private
*/
_readingNDCodes(): boolean;
/**
* Reads the code length code count and prepares for code length decoding.
*
* @private
*/
_readingCodes(): boolean;
/**
* Reads the code length codes in the prescribed order and builds the code length tree.
*
* @private
*/
_readingCLCodes(): boolean;
/**
* Reads and expands code length repeat instructions into the combined code list.
*
* @private
*/
_readingTCBefore(): boolean;
/**
* Maps the block type bits to the corresponding block type value.
*
* @private
*/
_getBlockType(type: number): _BlockType;
/**
* Maps a numeric state value to the corresponding inflater state.
*
* @private
*/
_getInflaterState(value: number): _InflaterState;
/**
* Maps an inflater state to its numeric value for ordering.
*
* @private
*/
_getInflaterStateValue(state: _InflaterState): number;
}