Kieker 1.9

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:
Serializable, Comparable<BinaryCompressionMethod>

public enum BinaryCompressionMethod
extends 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(String name)
          This method tries to search for a suitable compression method using the extension of the file.
abstract  DataInputStream getDataInputStream(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  DataOutputStream getDataOutputStream(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.
 String getFileExtension()
           
static boolean hasValidFileExtension(String name)
          This method checks whether there exists a suitable compression method for the extension of the file.
static BinaryCompressionMethod valueOf(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're declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, 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 final BinaryCompressionMethod[] values()
Returns an array containing the constants of this enum type, in the order they're 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're declared

valueOf

public static BinaryCompressionMethod 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

getFileExtension

public final String getFileExtension()

getDataOutputStream

public abstract DataOutputStream getDataOutputStream(File outputFile,
                                                     int bufferSize)
                                              throws 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:
IOException - If something went wrong during the initialization.

getDataInputStream

public abstract DataInputStream getDataInputStream(File inputFile,
                                                   int bufferSize)
                                            throws 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:
IOException - If something went wrong during the initialization.

hasValidFileExtension

public static final boolean hasValidFileExtension(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(String name)
                                                        throws 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:
IllegalArgumentException - If a suitable method was not found.
See Also:
hasValidFileExtension(String)

Kieker 1.9

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