private void decodeChunkHeader() { int control = inputStream.ReadByte(); inputPosition++; if (control == 0x00) { endReached = true; return; } if (control >= 0xE0 || control == 0x01) { needProps = true; needDictReset = false; outWindow.Reset(); } else if (needDictReset) { throw new DataErrorException(); } if (control >= 0x80) { uncompressedChunk = false; availableBytes = (control & 0x1F) << 16; availableBytes += (inputStream.ReadByte() << 8) + inputStream.ReadByte() + 1; inputPosition += 2; rangeDecoderLimit = (inputStream.ReadByte() << 8) + inputStream.ReadByte() + 1; inputPosition += 2; if (control >= 0xC0) { needProps = false; props[0] = (byte)inputStream.ReadByte(); inputPosition++; decoder = new Decoder(); decoder.SetDecoderProperties(props); } else if (needProps) { throw new DataErrorException(); } else if (control >= 0xA0) { decoder = new Decoder(); decoder.SetDecoderProperties(props); } rangeDecoder.Init(inputStream); } else if (control > 0x02) { throw new DataErrorException(); } else { uncompressedChunk = true; availableBytes = (inputStream.ReadByte() << 8) + inputStream.ReadByte() + 1; inputPosition += 2; } }
private void DecodeChunkHeader() { int control = _inputStream.ReadByte(); _inputPosition++; if (control == 0x00) { _endReached = true; return; } if (control >= 0xE0 || control == 0x01) { _needProps = true; _needDictReset = false; _outWindow.Reset(); } else if (_needDictReset) { throw new DataErrorException(); } if (control >= 0x80) { _uncompressedChunk = false; _availableBytes = (control & 0x1F) << 16; _availableBytes += (_inputStream.ReadByte() << 8) + _inputStream.ReadByte() + 1; _inputPosition += 2; _rangeDecoderLimit = (_inputStream.ReadByte() << 8) + _inputStream.ReadByte() + 1; _inputPosition += 2; if (control >= 0xC0) { _needProps = false; Properties[0] = (byte)_inputStream.ReadByte(); _inputPosition++; _decoder = new Decoder(); _decoder.SetDecoderProperties(Properties); } else if (_needProps) { throw new DataErrorException(); } else if (control >= 0xA0) { _decoder = new Decoder(); _decoder.SetDecoderProperties(Properties); } _rangeDecoder.Init(_inputStream); } else if (control > 0x02) { throw new DataErrorException(); } else { _uncompressedChunk = true; _availableBytes = (_inputStream.ReadByte() << 8) + _inputStream.ReadByte() + 1; _inputPosition += 2; } }