Package com.linkedin.venice.compression
Class VeniceCompressor
java.lang.Object
com.linkedin.venice.compression.VeniceCompressor
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
GzipCompressor
,NoopCompressor
,ZstdWithDictCompressor
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
VeniceCompressor
(CompressionStrategy compressionStrategy) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected abstract void
byte[]
compress
(byte[] data) compress
(ByteBuffer src, int startPositionOfOutput) protected abstract byte[]
compressInternal
(byte[] data) protected abstract ByteBuffer
compressInternal
(ByteBuffer src, int startPositionOfOutput) decompress
(byte[] data, int offset, int length) decompress
(InputStream inputStream) decompress
(ByteBuffer data) decompressAndPrependSchemaHeader
(byte[] data, int offset, int length, int schemaHeader) This method tries to decompress data and maybe prepend the schema header.protected abstract ByteBuffer
decompressAndPrependSchemaHeaderInternal
(byte[] data, int offset, int length, int schemaHeader) protected abstract ByteBuffer
decompressInternal
(byte[] data, int offset, int length) protected abstract InputStream
decompressInternal
(InputStream inputStream) protected abstract ByteBuffer
decompressInternal
(ByteBuffer data)
-
Field Details
-
SCHEMA_HEADER_LENGTH
protected static final int SCHEMA_HEADER_LENGTH- See Also:
-
-
Constructor Details
-
VeniceCompressor
-
-
Method Details
-
compress
- Throws:
IOException
-
compressInternal
- Throws:
IOException
-
compress
- Throws:
IOException
-
compressInternal
protected abstract ByteBuffer compressInternal(ByteBuffer src, int startPositionOfOutput) throws IOException - Throws:
IOException
-
decompress
- Throws:
IOException
-
decompressInternal
- Throws:
IOException
-
decompress
- Throws:
IOException
-
decompressInternal
protected abstract ByteBuffer decompressInternal(byte[] data, int offset, int length) throws IOException - Throws:
IOException
-
decompressAndPrependSchemaHeader
public ByteBuffer decompressAndPrependSchemaHeader(byte[] data, int offset, int length, int schemaHeader) throws IOException This method tries to decompress data and maybe prepend the schema header. The returned ByteBuffer will be backed by byte array that starts with schema header, followed by the decompressed data. The ByteBuffer will be positioned at the beginning of the decompressed data and the remaining of the ByteBuffer will be the length of the decompressed data.- Throws:
IOException
-
decompressAndPrependSchemaHeaderInternal
protected abstract ByteBuffer decompressAndPrependSchemaHeaderInternal(byte[] data, int offset, int length, int schemaHeader) throws IOException - Throws:
IOException
-
getCompressionStrategy
-
decompress
- Throws:
IOException
-
decompressInternal
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
closeInternal
- Throws:
IOException
-