Decoder
public final class PackBitsDecoder extends Object implements Decoder
Header byte | Data |
---|---|
0 to 127 | 1 + n literal bytes of data |
0 to -127 | One byte of data, repeated 1 - n times in the decompressed output |
-128 | No operation |
Constructor | Description |
---|---|
PackBitsDecoder() |
Creates a
PackBitsDecoder . |
PackBitsDecoder(boolean disableNoOp) |
Creates a
PackBitsDecoder , with optional compatibility mode. |
PackBitsDecoder(int sampleSize,
boolean disableNoOp) |
Creates a
PackBitsDecoder , with optional compatibility mode. |
Modifier and Type | Method | Description |
---|---|---|
int |
decode(InputStream stream,
ByteBuffer buffer) |
Decodes bytes from the given input stream, to the given buffer.
|
public PackBitsDecoder()
PackBitsDecoder
.public PackBitsDecoder(boolean disableNoOp)
PackBitsDecoder
, with optional compatibility mode.
As some implementations of PackBits-like encoders treat -128
as length of
a compressed run, instead of a no-op, it's possible to disable no-ops for compatibility.
Should be used with caution, even though, most known encoders never write no-ops in the compressed streams.disableNoOp
- true
if -128
should be treated as a compressed run, and not a no-oppublic PackBitsDecoder(int sampleSize, boolean disableNoOp)
PackBitsDecoder
, with optional compatibility mode.
As some implementations of PackBits-like encoders treat -128
as length of
a compressed run, instead of a no-op, it's possible to disable no-ops for compatibility.
Should be used with caution, even though, most known encoders never write no-ops in the compressed streams.disableNoOp
- true
if -128
should be treated as a compressed run, and not a no-oppublic int decode(InputStream stream, ByteBuffer buffer) throws IOException
decode
in interface Decoder
stream
- the stream to decode frombuffer
- a byte array, minimum 128 (or 129 if no-op is disabled) bytes longIOException
DecodeException
- if encoded data is corrupt.EOFException
- if a premature end-of-file is encountered.Copyright © 2018. All rights reserved.