public class CompressionManager
extends java.lang.Object
To avoid direct dependencies to compression libraries, the
ServiceLoader
concept is used. This allows additional compression
types to be added without changing any SimLib class. Without additional
classes, the SimLib supports uncompressed files and gzip compressed files,
only.
To implement additional compression types, you have to
CompressionProvider
ServiceLoader
and
http://ant.apache.org/manual/Tasks/jar.html
Constructor and Description |
---|
CompressionManager() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getFilenameWithExtension(java.lang.String fileName,
CompressionType compressionType) |
static java.io.InputStream |
getInputStream(java.io.File file)
Opens the given file for reading.
|
static java.io.OutputStream |
getOutputStream(java.io.File file,
CompressionType compressionType)
Opens the given file for writing.
|
public static java.io.InputStream getInputStream(java.io.File file) throws java.io.FileNotFoundException
file
- the file to open, with extension as it is on the diskjava.io.FileNotFoundException
- when the file is not readablepublic static java.io.OutputStream getOutputStream(java.io.File file, CompressionType compressionType) throws java.io.FileNotFoundException
getFilenameWithExtension(String, CompressionType)
.file
- the file to open, with extension as it shall be createdjava.io.FileNotFoundException
- when the file cannot be createdpublic static java.lang.String getFilenameWithExtension(java.lang.String fileName, CompressionType compressionType)