Base class for Avro-supported compression codecs for data files. Note that Codec objects may maintain internal state (e.g. buffers) and are not thread safe.
More...
|
abstract byte[] | Compress (byte[] uncompressedData) |
| Compress data using implemented codec. More...
|
|
abstract void | Compress (MemoryStream inputStream, MemoryStream outputStream) |
| Compress data using implemented codec. More...
|
|
virtual byte[] | Decompress (byte[] compressedData) |
| Decompress data using implemented codec. More...
|
|
abstract byte[] | Decompress (byte[] compressedData, int length) |
| Decompress data using implemented codec More...
|
|
abstract string | GetName () |
| Name of this codec type. More...
|
|
abstract override bool | Equals (object other) |
| Codecs must implement an equals() method. More...
|
|
abstract override int | GetHashCode () |
| Codecs must implement a HashCode() method that is consistent with Equals. More...
|
|
delegate Codec | CodecResolver (string codecMetaString) |
| Represents a function capable of resolving a codec string with a matching codec implementation a reader can use to decompress data. More...
|
|
override string | ToString () |
| Returns name of codec. More...
|
|
Base class for Avro-supported compression codecs for data files. Note that Codec objects may maintain internal state (e.g. buffers) and are not thread safe.
◆ Type
Codec types.
Enumerator |
---|
Deflate | Codec type that implements the "deflate" compression algorithm.
|
Null | Codec that does not perform any compression.
|
Snappy | Codec type that implements the "Snappy" compression algorithm.
|
BZip2 | Codec type that implements the "BZip2" compression algorithm.
|
XZ | Codec type that implements the "XZ" compression algorithm.
|
Zstandard | Codec type that implements the "Zstandard" compression algorithm.
|
◆ CodecResolver()
delegate Codec Avro.File.Codec.CodecResolver |
( |
string |
codecMetaString | ) |
|
Represents a function capable of resolving a codec string with a matching codec implementation a reader can use to decompress data.
- Parameters
-
codecMetaString | The codec string |
◆ Compress() [1/2]
abstract byte [] Avro.File.Codec.Compress |
( |
byte[] |
uncompressedData | ) |
|
|
pure virtual |
◆ Compress() [2/2]
abstract void Avro.File.Codec.Compress |
( |
MemoryStream |
inputStream, |
|
|
MemoryStream |
outputStream |
|
) |
| |
|
pure virtual |
Compress data using implemented codec.
- Parameters
-
inputStream | The stream which contains the data to be compressed. |
outputStream | A reusable stream which will hold the compressed data. That stream should be empty. |
Implemented in Avro.File.DeflateCodec, and Avro.File.NullCodec.
◆ CreateCodec()
static Codec Avro.File.Codec.CreateCodec |
( |
Type |
codecType | ) |
|
|
inlinestatic |
Factory method to return child codec instance based on Codec.Type.
- Parameters
-
codecType | Type of the codec. |
- Returns
- Codec based on type.
◆ CreateCodecFromString()
static Codec Avro.File.Codec.CreateCodecFromString |
( |
string |
codecType | ) |
|
|
inlinestatic |
Factory method to return child codec instance based on string type.
- Parameters
-
codecType | Type of the codec. |
- Returns
- Codec based on type.
◆ Decompress() [1/2]
virtual byte [] Avro.File.Codec.Decompress |
( |
byte[] |
compressedData | ) |
|
|
inlinevirtual |
Decompress data using implemented codec.
- Parameters
-
compressedData | The buffer holding data to decompress. |
- Returns
- A byte array holding the decompressed data.
◆ Decompress() [2/2]
abstract byte [] Avro.File.Codec.Decompress |
( |
byte[] |
compressedData, |
|
|
int |
length |
|
) |
| |
|
pure virtual |
Decompress data using implemented codec
- Parameters
-
compressedData | The buffer holding data to decompress. |
length | The actual length of bytes to decompress from the buffer. |
- Returns
- A byte array holding the decompressed data.
Implemented in Avro.File.DeflateCodec, and Avro.File.NullCodec.
◆ Equals()
abstract override bool Avro.File.Codec.Equals |
( |
object |
other | ) |
|
|
pure virtual |
Codecs must implement an equals() method.
- Parameters
-
other | The object to compare with this instance. |
- Returns
true
if the specified object is equal to this instance; otherwise, false
.
Implemented in Avro.File.DeflateCodec, and Avro.File.NullCodec.
◆ GetHashCode()
abstract override int Avro.File.Codec.GetHashCode |
( |
| ) |
|
|
pure virtual |
Codecs must implement a HashCode() method that is consistent with Equals.
- Returns
- A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Implemented in Avro.File.DeflateCodec, and Avro.File.NullCodec.
◆ GetName()
abstract string Avro.File.Codec.GetName |
( |
| ) |
|
|
pure virtual |
◆ RegisterResolver()
static void Avro.File.Codec.RegisterResolver |
( |
CodecResolver |
resolver | ) |
|
|
inlinestatic |
Registers a function that will attempt to resolve a codec identifying string with a matching codec implementation when reading compressed Avro data.
- Parameters
-
resolver | A function that is able to find a codec implementation for a given codec string |
◆ ToString()
override string Avro.File.Codec.ToString |
( |
| ) |
|
|
inline |
Returns name of codec.
- Returns
- A string that represents this instance.
The documentation for this class was generated from the following file:
- src/apache/main/File/Codec.cs