public class MultipleFilesOutput extends Object implements StreamFactory
Modifier and Type | Field and Description |
---|---|
private File |
basename
Base file name.
|
private PrintStream |
defaultStream
Default stream to write to when no name is supplied.
|
private static String |
EXTENSION
File name extension.
|
private static String |
GZIP_EXTENSION
GZip extra file extension
|
private static Logging |
LOG
Logger for debugging.
|
private HashMap<String,PrintStream> |
map
HashMap of open print streams.
|
private boolean |
usegzip
Control gzip compression of output.
|
Constructor and Description |
---|
MultipleFilesOutput(File base)
Constructor
|
MultipleFilesOutput(File base,
boolean gzip)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
closeAllStreams()
Close (and forget) all output streams.
|
private PrintStream |
getDefaultStream()
Retrieve/open the default output stream.
|
protected boolean |
isGzipCompression()
Get GZIP compression flag.
|
private PrintStream |
newStream(String name)
Open a new stream of the given name
|
PrintStream |
openStream(String filename)
Retrieve the output stream for the given file name.
|
protected void |
setGzipCompression(boolean usegzip)
Set GZIP compression flag.
|
private static final String EXTENSION
private static final String GZIP_EXTENSION
private PrintStream defaultStream
private File basename
private HashMap<String,PrintStream> map
private boolean usegzip
private static final Logging LOG
public MultipleFilesOutput(File base)
base
- Base file name (folder name)public MultipleFilesOutput(File base, boolean gzip)
base
- Base file name (folder name)gzip
- Use gzip compression.private PrintStream getDefaultStream() throws IOException
IOException
private PrintStream newStream(String name) throws IOException
name
- file name (which will be appended to the base name)IOException
public PrintStream openStream(String filename) throws IOException
openStream
in interface StreamFactory
filename
- Output label.IOException
- on IO errorprotected boolean isGzipCompression()
protected void setGzipCompression(boolean usegzip)
usegzip
- use GZIP compressionpublic void closeAllStreams()
closeAllStreams
in interface StreamFactory