Class GZipCompression

    • Constructor Detail

      • GZipCompression

        public GZipCompression()
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: CompressionFormat
        Gets the name of the compression algorithm.
        Specified by:
        getName in interface CompressionFormat
        Returns:
        the well-known name of the compression format
      • isSplittable

        public boolean isSplittable()
        Description copied from interface: CompressionFormat
        Indicates whether compressed data files may be split. Generally, compressed data cannot be split.
        Specified by:
        isSplittable in interface CompressionFormat
        Returns:
        true if the compression format allow file splits, false otherwise.
      • isCompressedFilename

        public boolean isCompressedFilename​(String fileName)
        Description copied from interface: CompressionFormat
        Indicates whether the specified file name is compressed in this format. Generally, this is done by looking at the file suffix.
        Specified by:
        isCompressedFilename in interface CompressionFormat
        Parameters:
        fileName - the file name to check
        Returns:
        true if the file is believed to be compressed in this format, false otherwise.
      • getUncompressedFilename

        public String getUncompressedFilename​(String fileName)
        Description copied from interface: CompressionFormat
        Strips any file suffix associated with this format from the given file name.
        Specified by:
        getUncompressedFilename in interface CompressionFormat
        Parameters:
        fileName - the file name to process
        Returns:
        the expected name of the uncompressed file
      • getCompressedFilename

        public String getCompressedFilename​(String fileName)
        Description copied from interface: CompressionFormat
        Adds the common file suffix associated with this format to the given file name.
        Specified by:
        getCompressedFilename in interface CompressionFormat
        Parameters:
        fileName - the file name to process
        Returns:
        the expected name of the compressed file
      • getSplitIterator

        public SplitIterator getSplitIterator​(FileClient client,
                                              Path filePath,
                                              SplitOptions options)
                                       throws IOException
        Description copied from interface: CompressionFormat
        Create a 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.
        Specified by:
        getSplitIterator in interface CompressionFormat
        Parameters:
        client - the file client in use
        filePath - path to the input file
        options - splitting options
        Returns:
        an iterator of the split(s) for the input file
        Throws:
        IOException - if an I/O error occurs
      • decompressSplitStream

        public SplitInputStream decompressSplitStream​(DataSplit split,
                                                      InputStream in,
                                                      int bufferSize)
                                               throws IOException
        Description copied from interface: CompressionFormat
        Wraps the specified stream for a split in a decompressor for the format. The format must be splittable or an UnsupportedOperationException will be thrown.
        Specified by:
        decompressSplitStream in interface CompressionFormat
        Parameters:
        split - split being read and decompressed
        in - the compressed byte stream for a split to decompress
        Returns:
        the uncompressed data stream
        Throws:
        IOException - if an I/O error occurs