Enum Compression

    • Method Detail

      • values

        public static Compression[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Compression c : Compression.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Compression valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • byExtension

        public static Compression byExtension​(String name)
        Determines the compression type depending on the suffix of name.
        Parameters:
        name - File name including extension
        Returns:
        the compression type
      • forContentType

        public static Compression forContentType​(String contentType)
        Determines the compression type based on the content type (MIME type).
        Parameters:
        contentType - the content type
        Returns:
        the compression type
      • getXZInputStream

        public static org.apache.commons.compress.compressors.xz.XZCompressorInputStream getXZInputStream​(InputStream in)
                                                                                                   throws IOException
        Returns a XZ input stream wrapping given input stream.
        Parameters:
        in - The raw input stream
        Returns:
        a XZ input stream wrapping given input stream, or null if in is null
        Throws:
        IOException - if the given input stream does not contain valid BZ2 header
        Since:
        13350
      • getBZip2InputStream

        public static org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream getBZip2InputStream​(InputStream in)
                                                                                                            throws IOException
        Returns a Bzip2 input stream wrapping given input stream.
        Parameters:
        in - The raw input stream
        Returns:
        a Bzip2 input stream wrapping given input stream, or null if in is null
        Throws:
        IOException - if the given input stream does not contain valid BZ2 header
        Since:
        12772 (moved from Utils, there since 7867)
      • getGZipInputStream

        public static GZIPInputStream getGZipInputStream​(InputStream in)
                                                  throws IOException
        Returns a Gzip input stream wrapping given input stream.
        Parameters:
        in - The raw input stream
        Returns:
        a Gzip input stream wrapping given input stream, or null if in is null
        Throws:
        IOException - if an I/O error has occurred
        Since:
        12772 (moved from Utils, there since 7119)
      • getZipInputStream

        public static ZipInputStream getZipInputStream​(InputStream in)
                                                throws IOException
        Returns a Zip input stream wrapping given input stream.
        Parameters:
        in - The raw input stream
        Returns:
        a Zip input stream wrapping given input stream, or null if in is null
        Throws:
        IOException - if an I/O error has occurred
        Since:
        12772 (moved from Utils, there since 7119)