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.brotli.dec; 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[] output; 17 byte[] byteBuffer; // BitReader 18 19 short[] shortBuffer; // BitReader 20 21 int[] intBuffer; // BitReader 22 int[] rings; 23 int[] blockTrees; 24 int[] hGroup0; 25 int[] hGroup1; 26 int[] hGroup2; 27 28 long accumulator64; // BitReader: pre-fetched bits. 29 30 int runningState; // Default value is 0 == Decode.UNINITIALIZED 31 int nextRunningState; 32 int accumulator32; // BitReader: pre-fetched bits. 33 int bitOffset; // BitReader: bit-reading position in accumulator. 34 int halfOffset; // BitReader: offset of next item in intBuffer/shortBuffer. 35 int tailBytes; // BitReader: number of bytes in unfinished half. 36 int endOfStreamReached; // BitReader: input stream is finished. 37 int metaBlockLength; 38 int inputEnd; 39 int isUncompressed; 40 int isMetadata; 41 int literalBlockLength; 42 int numLiteralBlockTypes; 43 int commandBlockLength; 44 int numCommandBlockTypes; 45 int distanceBlockLength; 46 int numDistanceBlockTypes; 47 int pos; 48 int maxDistance; 49 int distRbIdx; 50 int trivialLiteralContext; 51 int literalTreeIndex; 52 int literalTree; 53 int j; 54 int insertLength; 55 int contextMapSlice; 56 int distContextMapSlice; 57 int contextLookupOffset1; 58 int contextLookupOffset2; 59 int treeCommandOffset; 60 int distanceCode; 61 int numDirectDistanceCodes; 62 int distancePostfixMask; 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 77 InputStream input; // BitReader 78 State()79 State() { 80 this.ringBuffer = new byte[0]; 81 this.rings = new int[10]; 82 this.rings[0] = 16; 83 this.rings[1] = 15; 84 this.rings[2] = 11; 85 this.rings[3] = 4; 86 } 87 } 88