Class PackBits
java.lang.Object
org.apache.sis.internal.storage.inflater.PixelChannel
org.apache.sis.internal.storage.inflater.CompressionChannel
org.apache.sis.internal.storage.inflater.PackBits
- All Implemented Interfaces:
Closeable, AutoCloseable, Channel, ReadableByteChannel
Inflater for values encoded with the "PackBits" compression.
This compression is described in section 9 of TIFF 6 specification.
- Since:
- 1.1
- Version:
- 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate byteByte to copy many times.private intNumber of times to copy theduplicatedbyte.private intNumber of bytes to copy literally from the input.Fields inherited from class CompressionChannel
input, listeners -
Constructor Summary
ConstructorsConstructorDescriptionPackBits(ChannelDataInput input, StoreListeners listeners) Creates a new channel which will decompress data from the given input. -
Method Summary
Modifier and TypeMethodDescriptionintread(ByteBuffer target) Decompresses some bytes from the input into the given destination buffer.voidsetInputRegion(long start, long byteCount) Prepares this inflater for reading a new tile or a new band of a tile.Methods inherited from class CompressionChannel
close, createDataInput, finished, isOpen, repeat, resources
-
Field Details
-
literalCount
private int literalCountNumber of bytes to copy literally from the input. Only one ofliteralCountandduplicatedCountcan be non-zero. -
duplicatedCount
private int duplicatedCountNumber of times to copy theduplicatedbyte. Only one ofliteralCountandduplicatedCountcan be non-zero. -
duplicated
private byte duplicatedByte to copy many times. The number of copies is given byduplicatedCount.
-
-
Constructor Details
-
PackBits
Creates a new channel which will decompress data from the given input. ThesetInputRegion(long, long)method must be invoked after construction before a reading process can start.- Parameters:
input- the source of data to decompress.listeners- object where to report warnings.
-
-
Method Details
-
setInputRegion
Prepares this inflater for reading a new tile or a new band of a tile.- Overrides:
setInputRegionin classCompressionChannel- Parameters:
start- stream position where to start reading.byteCount- number of bytes to read from the input.- Throws:
IOException- if the stream cannot be seek to the given start position.
-
read
Decompresses some bytes from the input into the given destination buffer.- Parameters:
target- the buffer into which bytes are to be transferred.- Returns:
- the number of bytes read, or -1 if end-of-stream.
- Throws:
IOException- if some other I/O error occurs.
-