public class FlamOutputStream extends OutputStream
Constructor and Description |
---|
FlamOutputStream(String fileString,
String formatString)
Uses the native FLAM byte interface (written in C) to open a normal
file, a member in a FLAM4FILE, a GZIP file or a member in a concatenated
GZIP-, BZIP- or XZ-File or any other supported file format as an
OutputStream.
|
FlamOutputStream(String fileString,
String formatString,
String state)
Uses the native FLAM byte interface (written in C) to open a normal
file, a member in a FLAM4FILE, a GZIP file or a member in a concatenated
GZIP-, BZIP- or XZ-File or any other supported file format as an
OutputStream.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
String |
close(StatisticFormat statsFormat)
Closes this OutputStream and releases any system resources associated
with the stream.
|
void |
flush()
Flushes this output stream and forces any buffered output bytes to be written out.
|
static void |
loadLibrary()
Loads the native JNI-based library (flcbytjava) that backs the
functionality of this class.
|
static void |
loadLibrary(String dllPath)
Loads the native JNI-based library that backs the functionality
of this class from the file specified by the path passed as
argument.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public FlamOutputStream(String fileString, String formatString) throws CharacterCodingException, FlamException
Uses the native FLAM byte interface (written in C) to open a normal file, a member in a FLAM4FILE, a GZIP file or a member in a concatenated GZIP-, BZIP- or XZ-File or any other supported file format as an OutputStream. It supports base encoding, encryption, compression, character conversion and text formatting, among others.
This stream class is backed by a native C library (flcbytjava) which must be
loaded prior to calling this constructor by calling either
loadLibrary()
or loadLibrary(String)
. Failing to do so
results in undefined (JVM-dependent) behavior.
The file definition string parameter uses the same syntax as the write method of the FLCL CONV command. The complete syntax and help can be obtained with the corresponding functions below. The string must start with 'write.' followed by the corresponding method (binary/char/text/flam4/xml/...).
Example:"write.binary(file='test.gz' comp.gzip(level=BEST))"Please call:
getHelp(HelpSubject.WRITE_FILE, 10, null) getSyntax(HelpSubject.WRITE_FILE, 10, null)for more information.
The format string uses the syntax of the 'format' union which was specifically designed for the byte interface to format the byte stream into FLAM elements. The string must start with 'format.' followed by the corresponding method.
Examples:"format.text(method=CRLF suptws ccsid='UTF-16LE')" "format.bin()" "format.char(ccsid=DEFAULT)" "format.record(ccsid='IBM-1141')"Please call:
getHelp(HelpSubject.WRITE_FORMAT, 10, null) getSyntax(HelpSubject.WRITE_FORMAT, 10, null)for more information.
The file string defines how the FLAM elements are written to the file. The format string defines how your input data is converted into FLAM elements.
fileString
- A file string of the FLCL CONV syntax for write operationsformatString
- A format string specifying the input data formatCharacterCodingException
- if converting the parameter strings to the
charset required by the native interface failsFlamException
- if the specified file cannot be openedIllegalArgumentException
- if fileString does not specify a read operation ("read." or "input.")public FlamOutputStream(String fileString, String formatString, String state) throws CharacterCodingException, FlamException
Uses the native FLAM byte interface (written in C) to open a normal file, a member in a FLAM4FILE, a GZIP file or a member in a concatenated GZIP-, BZIP- or XZ-File or any other supported file format as an OutputStream. It supports base encoding, encryption, compression, character conversion and text formatting, among others.
This stream class is backed by a native C library (flcbytjava) which must be
loaded prior to calling this constructor by calling either
loadLibrary()
or loadLibrary(String)
. Failing to do so
results in undefined (JVM-dependent) behavior.
The file definition string parameter uses the same syntax as the write method of the FLCL CONV command. The complete syntax and help can be obtained with the corresponding functions below. The string must start with 'write.' followed by the corresponding method (binary/char/text/flam4/xml/...).
Example:"write.binary(file='test.gz' comp.gzip(level=BEST))"Please call:
getHelp(HelpSubject.WRITE_FILE, 10, null) getSyntax(HelpSubject.WRITE_FILE, 10, null)for more information.
The format string uses the syntax of the 'format' union which was specifically designed for the byte interface to format the byte stream into FLAM elements. The string must start with 'format.' followed by the corresponding method.
Examples:"format.text(method=CRLF suptws ccsid='UTF-16LE')" "format.bin()" "format.char(ccsid=DEFAULT)" "format.record(ccsid='IBM-1141')"Please call:
getHelp(HelpSubject.WRITE_FORMAT, 10, null) getSyntax(HelpSubject.WRITE_FORMAT, 10, null)for more information.
The file string defines how the FLAM elements are written to the file. The format string defines how your input data is converted into FLAM elements.
This constructor accepts an optional string containing internal state
information and can be used to transfer attributes, values and other
information from an input file opened by a FlamInputStream
to an output file opened by a FlamOutputStream
.
The state string contains mainly file attributes which must be known to fill header information for archives (GZIP, FLAM) correctly.
You can look up the state string syntax and help with the corresponding functions of classFlamByteInterface
below. The string must start
with 'state(' followed by the corresponding value definitions and closed
with ')'.
Example:
"state(member='test.txt' recf=FBA recl=120)"Please use (from
FlamByteInterface
):
getHelp(HelpSubject.STATE, 10, null) getSyntax(HelpSubject.STATE, 10, null)for more information.
fileString
- A file string of the FLCL CONV syntax for write operationsformatString
- A format string specifying the input data formatstate
- An optional string containing internal state information, may be nullCharacterCodingException
- if converting the parameter strings to the
charset required by the native interface failsFlamException
- if the specified file cannot be openedIllegalArgumentException
- if fileString does not specify a read operation ("read." or "input.")public static void loadLibrary()
FlamByteInterface.loadLibrary()
.FlamByteInterface.loadLibrary()
public static void loadLibrary(String dllPath)
FlamByteInterface.loadLibrary(String)
.dllPath
- Path to the (lib)flybytjava DLLFlamByteInterface.loadLibrary(String)
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
public String close(StatisticFormat statsFormat) throws FlamException, CharacterCodingException
close()
, this method can provide
statistical information.
You can specify the output format for statistics, e.g. a plain list
or XML.statsFormat
- Format of the returned statisticsFlamException
- if an error occurs while closing the fileCharacterCodingException
- if the statistics information string cannot be
converted from the native charset to a Unicode stringclose()
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b) throws IOException
write
in class OutputStream
IOException