Class SwiftWriter
The SwiftWriter writes SWIFT data, given as a sequence of SWIFT fields to a TextWriter.
Inheritance
Implements
Inherited Members
Namespace: Subsembly.Swift
Assembly: Subsembly.Sepa.dll
Syntax
public class SwiftWriter : IDisposable
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.
Declaration
public SwiftWriter(Stream aOutputStream, SwiftOptions nOptions)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | aOutputStream | Stream 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. |
SwiftOptions | nOptions | Flags 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
Type | Condition |
---|---|
System.ArgumentNullException | The parameter aOutputStream was null. |
SwiftWriter(TextWriter, SwiftOptions)
Creates an SwiftWriter writing to the given TextWriter.
Declaration
public SwiftWriter(TextWriter aTextWriter, SwiftOptions nOptions)
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextWriter | aTextWriter | The TextWriter to write the output to. The NewLine property of this TextWriter controls the actually written CRLF sequences. |
SwiftOptions | nOptions | Flags 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
Type | Condition |
---|---|
System.ArgumentNullException | The parameter aTextWriter was null. |
SwiftWriter(String, SwiftOptions)
Creates an SwiftWriter writing to the given file.
Declaration
public SwiftWriter(string sFileName, SwiftOptions nOptions)
Parameters
Type | Name | Description |
---|---|---|
System.String | sFileName | File name of the file to write to. This file will be created or overwritten with the data written to this SwiftWriter. |
SwiftOptions | nOptions | Flags that control the output of the SwiftWriter. Only a few of the defined SwiftOptions are applicable. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The parameter sFileName was |
System.ArgumentException | The parameter sFileName was an empty string. |
Methods
Close()
Declaration
public void Close()
Dispose()
Declaration
public void Dispose()
Flush()
Flushes the underlying TextWriter.
Declaration
public void Flush()
WriteEndOfBlock(String)
Writes an end-of-block SWIFT field.
Declaration
public void WriteEndOfBlock(string sBlockName)
Parameters
Type | Name | Description |
---|---|---|
System.String | sBlockName | The blockname of the ending block. |
WriteEndOfText()
Writes an end-of-text marker.
Declaration
public void WriteEndOfText()
WriteField(SwiftField)
Writes the given SWIFT field to the output stream.
Declaration
public void WriteField(SwiftField aSwiftField)
Parameters
Type | Name | Description |
---|---|---|
SwiftField | aSwiftField | SwiftField instance to be written. Must not be null and must not have the SwiftFieldType Null. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | The aSwiftField parameter was null. |
System.ArgumentException | The SWIFT field had the SwiftFieldType Null. |
System.IO.IOException | May be thrown by the stream when writing bytes to it. |
WriteField(String, String)
Writes a non-generic SWIFT field.
Declaration
public void WriteField(string sTag, string sContent)
Parameters
Type | Name | Description |
---|---|---|
System.String | sTag | Tag of field. |
System.String | sContent | Content of field. |
WriteField(String, String, String)
Writes a generic SWIFT field.
Declaration
public void WriteField(string sTag, string sQualifier, string sContent)
Parameters
Type | Name | Description |
---|---|---|
System.String | sTag | Tag of field. |
System.String | sQualifier | Qualifier of field. |
System.String | sContent | Content of field. |
WriteStartOfBlock(String)
Writes a start-of-block SWIFT field.
Declaration
public void WriteStartOfBlock(string sBlockName)
Parameters
Type | Name | Description |
---|---|---|
System.String | sBlockName | The blockname of the starting block. |