public class GZipCompression extends Object implements CompressionFormat
NONE
Constructor and Description |
---|
GZipCompression() |
Modifier and Type | Method and Description |
---|---|
OutputStream |
compressStream(OutputStream out)
Wraps the specified stream in a compressor for
the format.
|
SplitInputStream |
decompressSplitStream(DataSplit split,
InputStream in,
int bufferSize)
Wraps the specified stream for a split in a decompressor
for the format.
|
InputStream |
decompressStream(InputStream in)
Wraps the specified stream in a decompressor for
the format.
|
String |
getCompressedFilename(String fileName)
Adds the common file suffix associated with this format
to the given file name.
|
String |
getName()
Gets the name of the compression algorithm.
|
SplitIterator |
getSplitIterator(FileClient client,
Path filePath,
SplitOptions options)
Create a
SplitIterator for the given file path and options. |
String |
getUncompressedFilename(String fileName)
Strips any file suffix associated with this format
from the given file name.
|
boolean |
isCompressedFilename(String fileName)
Indicates whether the specified file name is compressed
in this format.
|
boolean |
isSplittable()
Indicates whether compressed data files may be split.
|
public String getName()
CompressionFormat
getName
in interface CompressionFormat
public boolean isSplittable()
CompressionFormat
isSplittable
in interface CompressionFormat
true
if the compression format allow
file splits, false
otherwise.public boolean isCompressedFilename(String fileName)
CompressionFormat
isCompressedFilename
in interface CompressionFormat
fileName
- the file name to checktrue
if the file is believed to be
compressed in this format, false
otherwise.public String getUncompressedFilename(String fileName)
CompressionFormat
getUncompressedFilename
in interface CompressionFormat
fileName
- the file name to processpublic String getCompressedFilename(String fileName)
CompressionFormat
getCompressedFilename
in interface CompressionFormat
fileName
- the file name to processpublic InputStream decompressStream(InputStream in) throws IOException
CompressionFormat
decompressStream
in interface CompressionFormat
in
- the compressed byte stream to decompressIOException
- if an I/O error occurspublic OutputStream compressStream(OutputStream out) throws IOException
CompressionFormat
compressStream
in interface CompressionFormat
out
- the uncompressed byte stream to compressIOException
- if an I/O error occurspublic SplitIterator getSplitIterator(FileClient client, Path filePath, SplitOptions options) throws IOException
CompressionFormat
SplitIterator
for the given file path and options.
Iterators may vary based on the compression format of an input data stream or
if the input is not compressed. For instance, compression formats that do not
support splitting will create an iterator with a single split: the whole file.getSplitIterator
in interface CompressionFormat
client
- the file client in usefilePath
- path to the input fileoptions
- splitting optionsIOException
- if an I/O error occurspublic SplitInputStream decompressSplitStream(DataSplit split, InputStream in, int bufferSize) throws IOException
CompressionFormat
UnsupportedOperationException
will be thrown.decompressSplitStream
in interface CompressionFormat
split
- split being read and decompressedin
- the compressed byte stream for a split to decompressIOException
- if an I/O error occursCopyright © 2024 Actian Corporation. All rights reserved.