Package org.apache.avro.file
Class Codec
java.lang.Object
org.apache.avro.file.Codec
- Direct Known Subclasses:
BZip2Codec,DeflateCodec,SnappyCodec,XZCodec,ZstandardCodec
Interface for Avro-supported compression codecs for data files.
Note that Codec objects may maintain internal state (e.g. buffers) and are
not thread safe.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract ByteBuffercompress(ByteBuffer uncompressedData) Compresses the input dataprotected static intcomputeOffset(ByteBuffer data) abstract ByteBufferdecompress(ByteBuffer compressedData) Decompress the dataabstract booleanCodecs must implement an equals() method.abstract StringgetName()Name of the codec; written to the file's metadata.abstract inthashCode()Codecs must implement a hashCode() method that is consistent with equals().toString()
-
Constructor Details
-
Codec
public Codec()
-
-
Method Details
-
getName
Name of the codec; written to the file's metadata. -
compress
Compresses the input data- Throws:
IOException
-
decompress
Decompress the data- Throws:
IOException
-
equals
Codecs must implement an equals() method. Two codecs, A and B are equal if: the result of A and B decompressing content compressed by A is the same AND the result of A and B decompressing content compressed by B is the same -
hashCode
public abstract int hashCode()Codecs must implement a hashCode() method that is consistent with equals(). -
toString
-
computeOffset
-