Enum FileType
java.lang.Object
java.lang.Enum<FileType>
org.torproject.metrics.collector.webstats.FileType
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<FileType>
,java.lang.constant.Constable
public enum FileType extends java.lang.Enum<FileType>
These enums provide compression functionality.
findType(java.lang.String)
determines the compression type by the given extension.
Compression can also be zero-compression, which is currently provided by
the PLAIN and JSON enums.
-
Nested Class Summary
-
Enum Constant Summary
-
Method Summary
Modifier and Type Method Description byte[]
compress(byte[] bytes)
Compresses the given bytes in memory and returns the compressed bytes.java.io.OutputStream
compress(java.io.OutputStream os)
Compresses the given InputStream and returns an OutputStream.byte[]
decompress(byte[] bytes)
Decompresses the given bytes in memory and returns the decompressed bytes.java.io.InputStream
decompress(java.io.InputStream is)
Decompresses the given InputStream and returns an OutputStream.static FileType
findType(java.lang.String ext)
ReturnsvalueOf
or the default enumPLAIN
, i.e., this method doesn't throw any exceptions and allways returns a valid enum.java.io.InputStream
inputStream(java.io.InputStream is)
Return the appropriate input stream.java.io.OutputStream
outputStream(java.io.OutputStream os)
Return the appropriate output stream.static FileType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static FileType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
findType
ReturnsvalueOf
or the default enumPLAIN
, i.e., this method doesn't throw any exceptions and allways returns a valid enum. -
inputStream
public java.io.InputStream inputStream(java.io.InputStream is) throws java.lang.ExceptionReturn the appropriate input stream.- Throws:
java.lang.Exception
-
outputStream
public java.io.OutputStream outputStream(java.io.OutputStream os) throws java.lang.ExceptionReturn the appropriate output stream.- Throws:
java.lang.Exception
-
compress
public byte[] compress(byte[] bytes) throws java.lang.ExceptionCompresses the given bytes in memory and returns the compressed bytes.- Throws:
java.lang.Exception
-
compress
public java.io.OutputStream compress(java.io.OutputStream os) throws java.lang.ExceptionCompresses the given InputStream and returns an OutputStream.- Throws:
java.lang.Exception
-
decompress
public java.io.InputStream decompress(java.io.InputStream is) throws java.lang.ExceptionDecompresses the given InputStream and returns an OutputStream.- Throws:
java.lang.Exception
-
decompress
public byte[] decompress(byte[] bytes) throws java.lang.ExceptionDecompresses the given bytes in memory and returns the decompressed bytes.- Throws:
java.lang.Exception
- Since:
- 2.2.0
-