Package com.linkedin.venice.compression
Class ZstdWithDictCompressor
- java.lang.Object
-
- com.linkedin.venice.compression.VeniceCompressor
-
- com.linkedin.venice.compression.ZstdWithDictCompressor
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class ZstdWithDictCompressor extends VeniceCompressor
-
-
Field Summary
-
Fields inherited from class com.linkedin.venice.compression.VeniceCompressor
SCHEMA_HEADER_LENGTH
-
-
Constructor Summary
Constructors Constructor Description ZstdWithDictCompressor(byte[] dictionary, int level)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static byte[]buildDictionaryOnSyntheticAvroData()Build a dictionary based on synthetic data.voidclose()byte[]compress(byte[] data)java.nio.ByteBuffercompress(java.nio.ByteBuffer data, int startPositionOfOutput)java.nio.ByteBufferdecompress(byte[] data, int offset, int length)java.io.InputStreamdecompress(java.io.InputStream inputStream)java.nio.ByteBufferdecompress(java.nio.ByteBuffer data)java.nio.ByteBufferdecompressAndPrependSchemaHeader(byte[] data, int offset, int length, int schemaHeader)This method tries to decompress data and maybe prepend the schema header.booleanequals(java.lang.Object o)inthashCode()-
Methods inherited from class com.linkedin.venice.compression.VeniceCompressor
getCompressionStrategy
-
-
-
-
Method Detail
-
compress
public byte[] compress(byte[] data)
- Specified by:
compressin classVeniceCompressor
-
compress
public java.nio.ByteBuffer compress(java.nio.ByteBuffer data, int startPositionOfOutput) throws java.io.IOException- Specified by:
compressin classVeniceCompressor- Throws:
java.io.IOException
-
decompress
public java.nio.ByteBuffer decompress(java.nio.ByteBuffer data) throws java.io.IOException- Specified by:
decompressin classVeniceCompressor- Throws:
java.io.IOException
-
decompress
public java.nio.ByteBuffer decompress(byte[] data, int offset, int length) throws java.io.IOException- Specified by:
decompressin classVeniceCompressor- Throws:
java.io.IOException
-
decompressAndPrependSchemaHeader
public java.nio.ByteBuffer decompressAndPrependSchemaHeader(byte[] data, int offset, int length, int schemaHeader) throws java.io.IOExceptionDescription copied from class:VeniceCompressorThis 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.- Specified by:
decompressAndPrependSchemaHeaderin classVeniceCompressor- Throws:
java.io.IOException
-
decompress
public java.io.InputStream decompress(java.io.InputStream inputStream) throws java.io.IOException- Specified by:
decompressin classVeniceCompressor- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classVeniceCompressor- Throws:
java.io.IOException
-
buildDictionaryOnSyntheticAvroData
public static byte[] buildDictionaryOnSyntheticAvroData()
Build a dictionary based on synthetic data. Used for empty push where there is no available dictionary to retrieve from a push job.- Returns:
- a zstd compression dictionary trained on small amount of avro data
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
-