Package org.apache.orc.impl
Class ZstdCodec
java.lang.Object
org.apache.orc.impl.ZstdCodec
- All Implemented Interfaces:
Closeable
,AutoCloseable
,CompressionCodec
,DirectDecompressionCodec
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.orc.CompressionCodec
CompressionCodec.DataKind, CompressionCodec.Options, CompressionCodec.SpeedModifier
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Return the codec to the pool.boolean
compress
(ByteBuffer in, ByteBuffer out, ByteBuffer overflow, CompressionCodec.Options options) Compresses an input ByteBuffer into an output ByteBuffer using Zstandard compression.void
decompress
(ByteBuffer in, ByteBuffer out) Decompress the in buffer to the out buffer.void
destroy()
Closes the codec, releasing the resources.void
directDecompress
(ByteBuffer in, ByteBuffer out) protected static byte[]
getBuffer
(int size) Get the default options for this codec.getKind()
Get the compression kind.boolean
void
reset()
Resets the codec, preparing it for reuse.
-
Constructor Details
-
ZstdCodec
public ZstdCodec(int level, int windowLog) -
ZstdCodec
public ZstdCodec()
-
-
Method Details
-
getZstdOptions
-
getBuffer
protected static byte[] getBuffer(int size) -
getDefaultOptions
Description copied from interface:CompressionCodec
Get the default options for this codec.- Specified by:
getDefaultOptions
in interfaceCompressionCodec
- Returns:
- the default options object
-
compress
public boolean compress(ByteBuffer in, ByteBuffer out, ByteBuffer overflow, CompressionCodec.Options options) throws IOException Compresses an input ByteBuffer into an output ByteBuffer using Zstandard compression. If the maximum bound of the number of output bytes exceeds the output ByteBuffer size, the remaining bytes are written to the overflow ByteBuffer.- Specified by:
compress
in interfaceCompressionCodec
- Parameters:
in
- the bytes to compressout
- the compressed bytesoverflow
- put any additional bytes hereoptions
- the options to control compression- Returns:
- ZstdOptions
- Throws:
IOException
-
decompress
Description copied from interface:CompressionCodec
Decompress the in buffer to the out buffer.- Specified by:
decompress
in interfaceCompressionCodec
- Parameters:
in
- the bytes to decompressout
- the decompressed bytes- Throws:
IOException
-
isAvailable
public boolean isAvailable()- Specified by:
isAvailable
in interfaceDirectDecompressionCodec
-
directDecompress
- Specified by:
directDecompress
in interfaceDirectDecompressionCodec
- Throws:
IOException
-
reset
public void reset()Description copied from interface:CompressionCodec
Resets the codec, preparing it for reuse.- Specified by:
reset
in interfaceCompressionCodec
-
destroy
public void destroy()Description copied from interface:CompressionCodec
Closes the codec, releasing the resources.- Specified by:
destroy
in interfaceCompressionCodec
-
getKind
Description copied from interface:CompressionCodec
Get the compression kind.- Specified by:
getKind
in interfaceCompressionCodec
-
close
public void close()Description copied from interface:CompressionCodec
Return the codec to the pool.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceCompressionCodec
-