Enum Class Compression

java.lang.Object
java.lang.Enum<Compression>
org.openstreetmap.josm.io.Compression
All Implemented Interfaces:
Serializable, Comparable<Compression>, Constable

public enum Compression extends Enum<Compression>
An enum representing the compression type of a resource.
  • Enum Constant Details

  • Constructor Details

  • Method Details

    • values

      public static Compression[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Compression valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class 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
    • getUncompressedInputStream

      Returns an un-compressing InputStream for in.
      Parameters:
      in - raw input stream
      Returns:
      un-compressing input stream
      Throws:
      IOException - if any I/O error occurs
    • 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

      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

      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)
    • getUncompressedFileInputStream

      Returns an un-compressing InputStream for the File file.
      Parameters:
      file - file
      Returns:
      un-compressing input stream
      Throws:
      IOException - if any I/O error occurs
    • getUncompressedFileInputStream

      Returns an un-compressing InputStream for the Path path.
      Parameters:
      path - path
      Returns:
      un-compressing input stream
      Throws:
      IOException - if any I/O error occurs
      Since:
      16816
    • getCompressedOutputStream

      Returns a compressing OutputStream for out.
      Parameters:
      out - raw output stream
      Returns:
      compressing output stream
      Throws:
      IOException - if any I/O error occurs
    • getCompressedFileOutputStream

      Returns a compressing OutputStream for the File file.
      Parameters:
      file - file
      Returns:
      compressing output stream
      Throws:
      IOException - if any I/O error occurs
      InvalidPathException - if a Path object cannot be constructed from the abstract path
    • getCompressedFileOutputStream

      Returns a compressing OutputStream for the Path path.
      Parameters:
      path - path
      Returns:
      compressing output stream
      Throws:
      IOException - if any I/O error occurs
      InvalidPathException - if a Path object cannot be constructed from the abstract path
      Since:
      16816