public final class GZip extends AbstractStreamCompressionProgram<T>
gzip
command. It understands a
subset of gzip
's command line arguments.
The program compresses one or several files. A file is compressed to a new file with ".gz" added to the name of the original file. The original file is deleted after it has been successfully compressed.
Usage: java -cp [classpath] org.at4j.comp.gzip.prog.GZip [options] file[s] Where: classpath - Should include the at4j and entityfs-core Jars. options - Command options. See below. file[s] - The files to compress. Options: -c - Write the compressed data to standard output and do not delete the original files. --decompress --uncompress -d - Decompress files (instead of compressing them). --suffix suf -S suf - Use the suffix "suf" instead of ".gz" for the compressed files. --threads no - Set the maximum number of threads to use for compressing. Different files may be compressed in different threads. The default number of threads is 1. --timing - After building the archive, print out how long it took.
GUnzip
Constructor and Description |
---|
GZip() |
Modifier and Type | Method and Description |
---|---|
protected InputStream |
createInputStream(int sourceNo,
T settings)
Create an input stream on the source entity for the given command line
arguments.
|
protected OutputStream |
createOutputStream(int targetNo,
T settings)
Create an output stream on the target entity for the given command line
arguments.
|
static void |
main(String[] args) |
protected org.at4j.comp.gzip.prog.GZipCommandLineArguments |
parseCommandLine(String[] args)
Subclasses implement this to parse their command line.
|
protected void |
postProcess(int sourceNo,
T settings)
Subclasses may override this for postprocessing the source and/or target
entity.
|
run
getArg, getParentLocation, isFlagArgument
protected org.at4j.comp.gzip.prog.GZipCommandLineArguments parseCommandLine(String[] args) throws CommandErrorException
AbstractStreamCompressionProgram
parseCommandLine
in class AbstractStreamCompressionProgram<org.at4j.comp.gzip.prog.GZipCommandLineArguments>
args
- The command line arguments, unparsed.CommandErrorException
- If the commands were invalid.public static void main(String[] args)
protected InputStream createInputStream(int sourceNo, T settings) throws IOException
AbstractStreamCompressionProgram
createInputStream
in class AbstractStreamCompressionProgram<T extends org.at4j.comp.gzip.prog.AbstractGZipProgramArguments>
sourceNo
- The index number for the source entity. The first source
has index == 0.settings
- The command line arguments.IOException
- On I/O errors.protected OutputStream createOutputStream(int targetNo, T settings) throws IOException, IgnoreFileException
AbstractStreamCompressionProgram
createOutputStream
in class AbstractStreamCompressionProgram<T extends org.at4j.comp.gzip.prog.AbstractGZipProgramArguments>
targetNo
- The index number for the target entity. The first target
has index == 0.settings
- The command line arguments.IOException
- On I/O errors.IgnoreFileException
- If the file should be ignored for some
reason.protected void postProcess(int sourceNo, T settings) throws IOException
AbstractStreamCompressionProgram
postProcess
in class AbstractStreamCompressionProgram<T extends org.at4j.comp.gzip.prog.AbstractGZipProgramArguments>
sourceNo
- The index number for the source and target entities.settings
- The command line arguments.IOException
- On I/O errors.