Package com.prowidesoftware.swift.io
Class AbstractWriter
- java.lang.Object
-
- com.prowidesoftware.swift.io.AbstractWriter
-
public abstract class AbstractWriter extends java.lang.Object
Base implementation for message writers.
Messages are converted into its FIN representation and written into the output file with proper delimiters and length.
The writer can be used in two different ways:- Writing messages directly into given Writer object, using the static write call method.
- Instantiating the writer for a particular File or stream, calling the write methods and closing the writer when all messages has been written
- Since:
- 7.8
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.Writer
writer
-
Constructor Summary
Constructors Constructor Description AbstractWriter(java.io.File file)
AbstractWriter(java.io.File _file, java.nio.charset.Charset _charset)
Constructs a writer to write content into a file using the specified charset (orStandardCharsets.UTF_8
if null).AbstractWriter(java.io.OutputStream stream)
AbstractWriter(java.io.OutputStream _stream, java.nio.charset.Charset _charset)
Constructs a writer to write content into a given stream usingStandardCharsets.UTF_8
.AbstractWriter(java.io.Writer writer)
Constructs a writer to write content into a given Writer instance.AbstractWriter(java.lang.String filename)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the stream.void
flush()
Flush the stream.
-
-
-
Constructor Detail
-
AbstractWriter
public AbstractWriter(java.io.Writer writer)
Constructs a writer to write content into a given Writer instance.
-
AbstractWriter
public AbstractWriter(java.io.File file) throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
-
AbstractWriter
public AbstractWriter(java.lang.String filename) throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
-
AbstractWriter
public AbstractWriter(java.io.File _file, java.nio.charset.Charset _charset) throws java.io.FileNotFoundException
Constructs a writer to write content into a file using the specified charset (orStandardCharsets.UTF_8
if null).- Parameters:
_file
- file to create_charset
- charset- Throws:
java.io.FileNotFoundException
- if file does not exist
-
AbstractWriter
public AbstractWriter(java.io.OutputStream stream)
-
AbstractWriter
public AbstractWriter(java.io.OutputStream _stream, java.nio.charset.Charset _charset)
Constructs a writer to write content into a given stream usingStandardCharsets.UTF_8
.- Parameters:
_stream
- stream to write to_charset
- charset
-
-