View Javadoc
1   /* Copyright 2015 Google Inc. All Rights Reserved.
2   
3      Distributed under MIT license.
4      See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
5   */
6   
7   package org.htmlunit.util.brotli;
8   
9   import java.io.InputStream;
10  
11  final class State {
12    byte[] ringBuffer;
13    byte[] contextModes;
14    byte[] contextMap;
15    byte[] distContextMap;
16    byte[] distExtraBits;
17    byte[] output;
18    byte[] byteBuffer;  // BitReader
19  
20    short[] shortBuffer; // BitReader
21  
22    int[] intBuffer;  // BitReader
23    int[] rings;
24    int[] blockTrees;
25    int[] literalTreeGroup;
26    int[] commandTreeGroup;
27    int[] distanceTreeGroup;
28    int[] distOffset;
29  
30    long accumulator64;  // BitReader: pre-fetched bits.
31  
32    int runningState;  // Default value is 0 == Decode.UNINITIALIZED
33    int nextRunningState;
34    int accumulator32;  // BitReader: pre-fetched bits.
35    int bitOffset;  // BitReader: bit-reading position in accumulator.
36    int halfOffset;  // BitReader: offset of next item in intBuffer/shortBuffer.
37    int tailBytes;  // BitReader: number of bytes in unfinished half.
38    int endOfStreamReached;  // BitReader: input stream is finished.
39    int metaBlockLength;
40    int inputEnd;
41    int isUncompressed;
42    int isMetadata;
43    int literalBlockLength;
44    int numLiteralBlockTypes;
45    int commandBlockLength;
46    int numCommandBlockTypes;
47    int distanceBlockLength;
48    int numDistanceBlockTypes;
49    int pos;
50    int maxDistance;
51    int distRbIdx;
52    int trivialLiteralContext;
53    int literalTreeIdx;
54    int commandTreeIdx;
55    int j;
56    int insertLength;
57    int contextMapSlice;
58    int distContextMapSlice;
59    int contextLookupOffset1;
60    int contextLookupOffset2;
61    int distanceCode;
62    int numDirectDistanceCodes;
63    int distancePostfixBits;
64    int distance;
65    int copyLength;
66    int maxBackwardDistance;
67    int maxRingBufferSize;
68    int ringBufferSize;
69    int expectedTotalSize;
70    int outputOffset;
71    int outputLength;
72    int outputUsed;
73    int ringBufferBytesWritten;
74    int ringBufferBytesReady;
75    int isEager;
76    int isLargeWindow;
77  
78    // Compound dictionary
79    int cdNumChunks;
80    int cdTotalSize;
81    int cdBrIndex;
82    int cdBrOffset;
83    int cdBrLength;
84    int cdBrCopied;
85    byte[][] cdChunks;
86    int[] cdChunkOffsets;
87    int cdBlockBits;
88    byte[] cdBlockMap;
89  
90    InputStream input = Utils.makeEmptyInput();  // BitReader
91  
92    State() {
93      this.ringBuffer = new byte[0];
94      this.rings = new int[10];
95      this.rings[0] = 16;
96      this.rings[1] = 15;
97      this.rings[2] = 11;
98      this.rings[3] = 4;
99    }
100 }