Class SwiftWriter
The SwiftWriter writes SWIFT data, given as a sequence of SWIFT fields to a TextWriter.
public class SwiftWriter : IDisposable
- Inheritance
-
SwiftWriter
- Implements
- Inherited Members
- Extension Methods
Remarks
Encoding and the CRLF usage are ultimately controlled by the properties of the TextWriter that is used to write the SWIFT data.
Constructors
SwiftWriter(Stream, SwiftOptions)
Creates an SwiftWriter writing to the given output Stream.
public SwiftWriter(Stream aOutputStream, SwiftOptions nOptions)
Parameters
aOutputStreamStreamStream to write the binary SWIFT data to. This must not be null and must be a writable stream. The stream will not be sought, hence it is not required that the stream is seekable.
nOptionsSwiftOptionsFlags that control the output of the SwiftWriter. Only a few of the defined SwiftOptions are applicable.
Remarks
The given SwiftOptions control the written Swift stream as follows.
| NoLeadingCRLF | The written Swift stream will not be started by a CRLF-Sequence. |
| BtxCRLF | The Swift stream will be written with BTX-Style '@@' CRLF-Sequences instead of proper ASCII CRLF-Sequences. |
| UnixLF | The Swift stream will be written with a single Unix-Style LF character instead of proper ASCII CRLF-Sequences. |
Exceptions
- ArgumentNullException
The parameter aOutputStream was null.
SwiftWriter(TextWriter, SwiftOptions)
Creates an SwiftWriter writing to the given TextWriter.
public SwiftWriter(TextWriter aTextWriter, SwiftOptions nOptions)
Parameters
aTextWriterTextWriterThe TextWriter to write the output to. The NewLine property of this TextWriter controls the actually written CRLF sequences.
nOptionsSwiftOptionsFlags that control the output of the SwiftWriter. The only flag that is observed is the NoLeadingCRLF flag. If this flag is included, then no leading new line sequence will be written.
Exceptions
- ArgumentNullException
The parameter aTextWriter was null.
SwiftWriter(string, SwiftOptions)
Creates an SwiftWriter writing to the given file.
public SwiftWriter(string sFileName, SwiftOptions nOptions)
Parameters
sFileNamestringFile name of the file to write to. This file will be created or overwritten with the data written to this SwiftWriter.
nOptionsSwiftOptionsFlags that control the output of the SwiftWriter. Only a few of the defined SwiftOptions are applicable.
Exceptions
- ArgumentNullException
The parameter sFileName was
null.- ArgumentException
The parameter sFileName was an empty string.
Methods
Close()
public void Close()
Dispose()
public void Dispose()
Flush()
Flushes the underlying TextWriter.
public void Flush()
WriteEndOfBlock(string)
Writes an end-of-block SWIFT field.
public void WriteEndOfBlock(string sBlockName)
Parameters
sBlockNamestringThe blockname of the ending block.
WriteEndOfText()
Writes an end-of-text marker.
public void WriteEndOfText()
WriteField(SwiftField)
Writes the given SWIFT field to the output stream.
public void WriteField(SwiftField aSwiftField)
Parameters
aSwiftFieldSwiftFieldSwiftField instance to be written. Must not be null and must not have the SwiftFieldType Null.
Exceptions
- ArgumentNullException
The aSwiftField parameter was null.
- ArgumentException
The SWIFT field had the SwiftFieldType Null.
- IOException
May be thrown by the stream when writing bytes to it.
WriteField(string, string)
Writes a non-generic SWIFT field.
public void WriteField(string sTag, string sContent)
Parameters
WriteField(string, string, string)
Writes a generic SWIFT field.
public void WriteField(string sTag, string sQualifier, string sContent)
Parameters
WriteStartOfBlock(string)
Writes a start-of-block SWIFT field.
public void WriteStartOfBlock(string sBlockName)
Parameters
sBlockNamestringThe blockname of the starting block.