|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.io.compress.BZip2Codec
@InterfaceAudience.Public @InterfaceStability.Evolving public class BZip2Codec
This class provides output and input streams for bzip2 compression and decompression. It uses the native bzip2 library on the system if possible, else it uses a pure-Java implementation of the bzip2 algorithm. The configuration parameter io.compression.codec.bzip2.library can be used to control this behavior. In the pure-Java mode, the Compressor and Decompressor interfaces are not implemented. Therefore, in that mode, those methods of CompressionCodec which have a Compressor or Decompressor type argument, throw UnsupportedOperationException. Currently, support for splittability is available only in the pure-Java mode; therefore, if a SplitCompressionInputStream is requested, the pure-Java implementation is used, regardless of the setting of the configuration parameter mentioned above.
| Constructor Summary | |
|---|---|
BZip2Codec()
Creates a new instance of BZip2Codec. |
|
| Method Summary | |
|---|---|
Compressor |
createCompressor()
Create a new Compressor for use by this CompressionCodec. |
Decompressor |
createDecompressor()
Create a new Decompressor for use by this CompressionCodec. |
CompressionInputStream |
createInputStream(InputStream in)
Create a CompressionInputStream that will read from the given
input stream and return a stream for uncompressed data. |
CompressionInputStream |
createInputStream(InputStream in,
Decompressor decompressor)
Create a CompressionInputStream that will read from the given
InputStream with the given Decompressor, and return a
stream for uncompressed data. |
SplitCompressionInputStream |
createInputStream(InputStream seekableIn,
Decompressor decompressor,
long start,
long end,
org.apache.hadoop.io.compress.SplittableCompressionCodec.READ_MODE readMode)
Creates CompressionInputStream to be used to read off uncompressed data in one of the two reading modes. |
CompressionOutputStream |
createOutputStream(OutputStream out)
Create a CompressionOutputStream that will write to the given
OutputStream. |
CompressionOutputStream |
createOutputStream(OutputStream out,
Compressor compressor)
Create a CompressionOutputStream that will write to the given
OutputStream with the given Compressor. |
Class<? extends Compressor> |
getCompressorType()
Get the type of Compressor needed by this CompressionCodec. |
Configuration |
getConf()
Return the configuration used by this object. |
Class<? extends Decompressor> |
getDecompressorType()
Get the type of Decompressor needed by this CompressionCodec. |
String |
getDefaultExtension()
.bz2 is recognized as the default extension for compressed BZip2 files |
void |
setConf(Configuration conf)
Set the configuration to be used by this object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BZip2Codec()
| Method Detail |
|---|
public void setConf(Configuration conf)
setConf in interface Configurableconf - the configuration object.public Configuration getConf()
getConf in interface Configurable
public CompressionOutputStream createOutputStream(OutputStream out)
throws IOException
CompressionOutputStream that will write to the given
OutputStream.
createOutputStream in interface CompressionCodecout - the location for the final output stream
IOException
public CompressionOutputStream createOutputStream(OutputStream out,
Compressor compressor)
throws IOException
CompressionOutputStream that will write to the given
OutputStream with the given Compressor.
createOutputStream in interface CompressionCodecout - the location for the final output streamcompressor - compressor to use
IOExceptionpublic Class<? extends Compressor> getCompressorType()
Compressor needed by this CompressionCodec.
getCompressorType in interface CompressionCodecpublic Compressor createCompressor()
Compressor for use by this CompressionCodec.
createCompressor in interface CompressionCodec
public CompressionInputStream createInputStream(InputStream in)
throws IOException
CompressionInputStream that will read from the given
input stream and return a stream for uncompressed data.
createInputStream in interface CompressionCodecin - the stream to read compressed bytes from
IOException
public CompressionInputStream createInputStream(InputStream in,
Decompressor decompressor)
throws IOException
CompressionInputStream that will read from the given
InputStream with the given Decompressor, and return a
stream for uncompressed data.
createInputStream in interface CompressionCodecin - the stream to read compressed bytes fromdecompressor - decompressor to use
IOException
public SplitCompressionInputStream createInputStream(InputStream seekableIn,
Decompressor decompressor,
long start,
long end,
org.apache.hadoop.io.compress.SplittableCompressionCodec.READ_MODE readMode)
throws IOException
createInputStream in interface SplittableCompressionCodecseekableIn - The InputStreamstart - The start offset into the compressed streamend - The end offset into the compressed streamreadMode - Controls whether progress is reported continuously or
only at block boundaries.
IOExceptionpublic Class<? extends Decompressor> getDecompressorType()
Decompressor needed by this CompressionCodec.
getDecompressorType in interface CompressionCodecpublic Decompressor createDecompressor()
Decompressor for use by this CompressionCodec.
createDecompressor in interface CompressionCodecpublic String getDefaultExtension()
getDefaultExtension in interface CompressionCodec
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||