Package org.openstreetmap.josm.io
Enum Class Compression
- All Implemented Interfaces:
Serializable,Comparable<Compression>,Constable
An enum representing the compression type of a resource.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CompressionbyExtension(String name) Determines the compression type depending on the suffix ofname.static CompressionforContentType(String contentType) Determines the compression type based on the content type (MIME type).static org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStreamReturns a Bzip2 input stream wrapping given input stream.static OutputStreamstatic OutputStreamReturns a compressingOutputStreamforout.static GZIPInputStreamReturns a Gzip input stream wrapping given input stream.static InputStreamstatic InputStreamReturns an un-compressingInputStreamforin.static org.apache.commons.compress.compressors.xz.XZCompressorInputStreamReturns a XZ input stream wrapping given input stream.static ZipInputStreamReturns a Zip input stream wrapping given input stream.static CompressionReturns the enum constant of this class with the specified name.static Compression[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
no compression -
BZIP2
bzip2 compression -
GZIP
gzip compression -
ZIP
zip compression -
XZ
xz compression
-
-
Constructor Details
-
Compression
private Compression()
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
byExtension
Determines the compression type depending on the suffix ofname.- Parameters:
name- File name including extension- Returns:
- the compression type
-
forContentType
Determines the compression type based on the content type (MIME type).- Parameters:
contentType- the content type- Returns:
- the compression type
-
getUncompressedInputStream
Returns an un-compressingInputStreamforin.- 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
nullifinisnull - 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
nullifinisnull - 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
nullifinisnull - 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
nullifinisnull - Throws:
IOException- if an I/O error has occurred- Since:
- 12772 (moved from
Utils, there since 7119)
-
getUncompressedFileInputStream
- Parameters:
file- file- Returns:
- un-compressing input stream
- Throws:
IOException- if any I/O error occurs
-
getUncompressedFileInputStream
- Parameters:
path- path- Returns:
- un-compressing input stream
- Throws:
IOException- if any I/O error occurs- Since:
- 16816
-
getCompressedOutputStream
Returns a compressingOutputStreamforout.- Parameters:
out- raw output stream- Returns:
- compressing output stream
- Throws:
IOException- if any I/O error occurs
-
getCompressedFileOutputStream
- Parameters:
file- file- Returns:
- compressing output stream
- Throws:
IOException- if any I/O error occursInvalidPathException- if a Path object cannot be constructed from the abstract path
-
getCompressedFileOutputStream
- Parameters:
path- path- Returns:
- compressing output stream
- Throws:
IOException- if any I/O error occursInvalidPathException- if a Path object cannot be constructed from the abstract path- Since:
- 16816
-