Top Description Inners Fields Constructors Methods
org.apache.avro.file

public Class DeflateCodec

extends Codec
Class Inheritance
Imports
java.io.IOException, .OutputStream, java.nio.ByteBuffer, java.util.zip.Deflater, .DeflaterOutputStream, .Inflater, .InflaterOutputStream, org.apache.avro.util.NonCopyingByteArrayOutputStream

Implements DEFLATE (RFC1951) compression and decompression. Note that there is a distinction between RFC1951 (deflate) and RFC1950 (zlib). zlib adds an extra 2-byte header at the front, and a 4-byte checksum at the end. The code here, by passing "true" as the "nowrap" option to Inflater and Deflater, is using RFC1951.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private int
private static final int
private Deflater
private Inflater
private boolean

Constructor Summary

AccessConstructor and Description
public
DeflateCodec(int compressionLevel)

Method Summary

Modifier and TypeMethod and Description
public ByteBuffer
compress(ByteBuffer data)

Implements abstract org.apache.avro.file.Codec.compress.

Compresses the input data
public ByteBuffer
decompress(ByteBuffer data)

Implements abstract org.apache.avro.file.Codec.decompress.

Decompress the data
public boolean
equals(Object
the reference object with which to compare.
obj
)

Implements abstract org.apache.avro.file.Codec.equals.

Codecs must implement an equals() method.
private Deflater
private Inflater
public String
getName()

Implements abstract org.apache.avro.file.Codec.getName.

Name of the codec; written to the file's metadata.
public int
hashCode()

Implements abstract org.apache.avro.file.Codec.hashCode.

Codecs must implement a hashCode() method that is consistent with equals().
public String
toString()

Overrides org.apache.avro.file.Codec.toString.

Returns a string representation of the object.
Inherited from org.apache.avro.file.Codec:
computeOffset

Field Detail

compressionLevelback to summary
private int compressionLevel
DEFAULT_BUFFER_SIZEback to summary
private static final int DEFAULT_BUFFER_SIZE
deflaterback to summary
private Deflater deflater
inflaterback to summary
private Inflater inflater
nowrapback to summary
private boolean nowrap

Constructor Detail

DeflateCodecback to summary
public DeflateCodec(int compressionLevel)

Method Detail

compressback to summary
public ByteBuffer compress(ByteBuffer data) throws IOException

Implements abstract org.apache.avro.file.Codec.compress.

Doc from org.apache.avro.file.Codec.compress.

Compresses the input data

Annotations
@Override
decompressback to summary
public ByteBuffer decompress(ByteBuffer data) throws IOException

Implements abstract org.apache.avro.file.Codec.decompress.

Doc from org.apache.avro.file.Codec.decompress.

Decompress the data

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Implements abstract org.apache.avro.file.Codec.equals.

Doc from org.apache.avro.file.Codec.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

Parameters
obj:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getDeflaterback to summary
private Deflater getDeflater()
getInflaterback to summary
private Inflater getInflater()
getNameback to summary
public String getName()

Implements abstract org.apache.avro.file.Codec.getName.

Doc from org.apache.avro.file.Codec.getName.

Name of the codec; written to the file's metadata.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Implements abstract org.apache.avro.file.Codec.hashCode.

Doc from org.apache.avro.file.Codec.hashCode.

Codecs must implement a hashCode() method that is consistent with equals().

Returns:int

Doc from java.lang.Object.hashCode.

a hash code value for this object.

Annotations
@Override
toStringback to summary
public String toString()

Overrides org.apache.avro.file.Codec.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.apache.avro.file back to summary

pack-priv Class DeflateCodec.Option

extends CodecFactory
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
Inherited from org.apache.avro.file.CodecFactory:
DEFAULT_DEFLATE_LEVELDEFAULT_XZ_LEVELDEFAULT_ZSTANDARD_BUFFERPOOLDEFAULT_ZSTANDARD_LEVEL

Constructor Summary

AccessConstructor and Description
pack-priv
Option(int compressionLevel)

Method Summary

Modifier and TypeMethod and Description
protected Codec
createInstance()

Implements abstract org.apache.avro.file.CodecFactory.createInstance.

Creates internal Codec.
Inherited from org.apache.avro.file.CodecFactory:
addCodecbzip2CodecdeflateCodecfromStringnullCodecsnappyCodectoStringxzCodeczstandardCodeczstandardCodeczstandardCodec

Field Detail

compressionLevelback to summary
private int compressionLevel

Constructor Detail

Optionback to summary
pack-priv Option(int compressionLevel)

Method Detail

createInstanceback to summary
protected Codec createInstance()

Implements abstract org.apache.avro.file.CodecFactory.createInstance.

Doc from org.apache.avro.file.CodecFactory.createInstance.

Creates internal Codec.

Annotations
@Override