Package org.apache.avro.file
Class CodecFactory
java.lang.Object
org.apache.avro.file.CodecFactory
Encapsulates the ability to specify and configure a compression codec.
Currently there are five codecs registered by default:
null
deflate
snappy
bzip2
xz
zstandard
addCodec(String, CodecFactory)
.-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final boolean
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic CodecFactory
addCodec
(String name, CodecFactory c) Adds a new codec implementation.static CodecFactory
bzip2 codec.protected abstract Codec
Creates internal Codec.static CodecFactory
deflateCodec
(int compressionLevel) Deflate codec, with specific compression. compressionLevel should be between 1 and 9, inclusive.static CodecFactory
fromString
(String s) Maps a codec name into a CodecFactory.static CodecFactory
Null codec, for no compression.static CodecFactory
Snappy codec.toString()
static CodecFactory
xzCodec
(int compressionLevel) XZ codec, with specific compression. compressionLevel should be between 1 and 9, inclusive.static CodecFactory
zstandardCodec
(int level) zstandard codec, with specific compression level.static CodecFactory
zstandardCodec
(int level, boolean useChecksum) zstandard codec, with specific compression level.static CodecFactory
zstandardCodec
(int level, boolean useChecksum, boolean useBufferPool) zstandard codec, with specific compression level, checksum, and bufferPool
-
Field Details
-
DEFAULT_DEFLATE_LEVEL
public static final int DEFAULT_DEFLATE_LEVEL- See Also:
-
DEFAULT_XZ_LEVEL
public static final int DEFAULT_XZ_LEVEL- See Also:
-
DEFAULT_ZSTANDARD_LEVEL
public static final int DEFAULT_ZSTANDARD_LEVEL- See Also:
-
DEFAULT_ZSTANDARD_BUFFERPOOL
public static final boolean DEFAULT_ZSTANDARD_BUFFERPOOL- See Also:
-
-
Constructor Details
-
CodecFactory
public CodecFactory()
-
-
Method Details
-
nullCodec
Null codec, for no compression. -
deflateCodec
Deflate codec, with specific compression. compressionLevel should be between 1 and 9, inclusive. -
xzCodec
XZ codec, with specific compression. compressionLevel should be between 1 and 9, inclusive. -
snappyCodec
Snappy codec. -
bzip2Codec
bzip2 codec. -
zstandardCodec
zstandard codec, with specific compression level.- Parameters:
level
- The compression level should be between -5 and 22, inclusive. Negative levels are 'fast' modes akin to lz4 or snappy, levels above 9 are generally for archival purposes, and levels above 18 use a lot of memory.
-
zstandardCodec
zstandard codec, with specific compression level.- Parameters:
level
- The compression level should be between -5 and 22, inclusive. Negative levels are 'fast' modes akin to lz4 or snappy, levels above 9 are generally for archival purposes, and levels above 18 use a lot of memory.useChecksum
- if true, will include a checksum with each data block
-
zstandardCodec
zstandard codec, with specific compression level, checksum, and bufferPool- Parameters:
level
- The compression level should be between -5 and 22, inclusive. Negative levels are 'fast' modes akin to lz4 or snappy, levels above 9 are generally for archival purposes, and levels above 18 use a lot of memory.useChecksum
- if true, will include a checksum with each data blockuseBufferPool
- if true, will use recycling buffer pool
-
createInstance
Creates internal Codec. -
fromString
Maps a codec name into a CodecFactory. Currently there are six codecs registered by default:null
deflate
snappy
bzip2
xz
zstandard
-
addCodec
Adds a new codec implementation. If name already had a codec associated with it, returns the previous codec. -
toString
-