Package org.jpedal.io.filter
Class BrotliInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.jpedal.io.filter.BrotliInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
An input stream that decodes data from a brotli encoded data from the wrapped stream
Brotli is "...a lossless compressed data format that compresses data using a combination of the LZ77 algorithm and Huffman coding, with efficiency comparable to the best currently available general-purpose compression methods"
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal int[]Ring buffer storing past distances, used alongsideSPECIAL_DISTANCESto reuse recent distancesintIndex of the last value added to the ring buffer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbytegetFromSlidingWindow(int distance) Returns a byte from the sliding window, offset backwards from thewindowWritePointer.booleanintread()intread(byte[] b, int off, int len) Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
distanceRingBuffer
public final int[] distanceRingBufferRing buffer storing past distances, used alongsideSPECIAL_DISTANCESto reuse recent distancesThis gets initialized at the beginning of the stream, not at each metablock
-
distanceRingBufferPointer
public int distanceRingBufferPointerIndex of the last value added to the ring buffer
-
-
Constructor Details
-
BrotliInputStream
-
-
Method Details
-
getFromSlidingWindow
public byte getFromSlidingWindow(int distance) Returns a byte from the sliding window, offset backwards from thewindowWritePointer. Accounts for wrapping the sliding window.You will always be getting values behind the
windowWritePointer, so the distance value is the backwards distance from the pointer. I.e, a value of2will get you the byte 2 positions behind the write pointer, orwindowWritePointer - 2- Parameters:
distance- How far behind thewindowWritePointerto get- Returns:
- a byte from the sliding window, offset backwards from the
windowWritePointer
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classFilterInputStream
-