Kieker 1.12

kieker.common.util.filesystem
Enum BinaryCompressionMethod

java.lang.Object
  extended by java.lang.Enum<BinaryCompressionMethod>
      extended by kieker.common.util.filesystem.BinaryCompressionMethod
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<BinaryCompressionMethod>

public enum BinaryCompressionMethod
extends java.lang.Enum<BinaryCompressionMethod>

This enum delivers different compression methods, which can be used to read and write compressed binary files.

Since:
1.7
Author:
Jan Waller

Enum Constant Summary
DEFLATE
          A binary compression method using the compression format "deflate".
GZIP
          A binary compression method using the compression format "GZIP".
NONE
          A binary compression method using no compression format.
ZIP
          A binary compression method using the compression format "ZIP".
 
Method Summary
static BinaryCompressionMethod getByFileExtension(java.lang.String name)
          This method tries to search for a suitable compression method using the extension of the file.
abstract  java.io.DataInputStream getDataInputStream(java.io.File inputFile, int bufferSize)
          Implementing compression methods should override this method to deliver an input stream which can be used to read data in a non-compressed way from the given file.
abstract  java.io.DataOutputStream getDataOutputStream(java.io.File outputFile, int bufferSize)
          Implementing compression methods should override this method to deliver an output stream which can be used to write data in a compressed way into the given file.
 java.lang.String getFileExtension()
           
static boolean hasValidFileExtension(java.lang.String name)
          This method checks whether there exists a suitable compression method for the extension of the file.
static BinaryCompressionMethod valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static BinaryCompressionMethod[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NONE

public static final BinaryCompressionMethod NONE
A binary compression method using no compression format.


DEFLATE

public static final BinaryCompressionMethod DEFLATE
A binary compression method using the compression format "deflate".


GZIP

public static final BinaryCompressionMethod GZIP
A binary compression method using the compression format "GZIP".


ZIP

public static final BinaryCompressionMethod ZIP
A binary compression method using the compression format "ZIP".

Method Detail

values

public static BinaryCompressionMethod[] 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 (BinaryCompressionMethod c : BinaryCompressionMethod.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static BinaryCompressionMethod valueOf(java.lang.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:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getFileExtension

public final java.lang.String getFileExtension()

getDataOutputStream

public abstract java.io.DataOutputStream getDataOutputStream(java.io.File outputFile,
                                                             int bufferSize)
                                                      throws java.io.IOException
Implementing compression methods should override this method to deliver an output stream which can be used to write data in a compressed way into the given file.

Parameters:
outputFile - The output file.
bufferSize - The buffer size for the stream
Returns:
A new output stream for the given file.
Throws:
java.io.IOException - If something went wrong during the initialization.

getDataInputStream

public abstract java.io.DataInputStream getDataInputStream(java.io.File inputFile,
                                                           int bufferSize)
                                                    throws java.io.IOException
Implementing compression methods should override this method to deliver an input stream which can be used to read data in a non-compressed way from the given file.

Parameters:
inputFile - The input file.
bufferSize - The buffer size for the stream
Returns:
A new input stream for the given file.
Throws:
java.io.IOException - If something went wrong during the initialization.

hasValidFileExtension

public static final boolean hasValidFileExtension(java.lang.String name)
This method checks whether there exists a suitable compression method for the extension of the file.

Parameters:
name - The name of the file.
Returns:
true if a suitable compression method exists.
See Also:
getByFileExtension(String)

getByFileExtension

public static final BinaryCompressionMethod getByFileExtension(java.lang.String name)
                                                        throws java.lang.IllegalArgumentException
This method tries to search for a suitable compression method using the extension of the file.

Parameters:
name - The name of the file.
Returns:
A suitable compression method if it exists.
Throws:
java.lang.IllegalArgumentException - If a suitable method was not found.
See Also:
hasValidFileExtension(String)

Kieker 1.12

Copyright 2015 Kieker Project, http://kieker-monitoring.net