public class SwiftWriter
extends java.lang.Object
Constructor and Description |
---|
SwiftWriter() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
ensureEols(java.lang.String content)
Makes sure all EOLs are swift compatible by replacing any line break in the parameter String with CRLF
|
static java.lang.String |
getInternalXml(SwiftMessage msg)
Get a string with the internal xml representation of a message.
|
static java.lang.String |
writeBlock1(SwiftBlock1 b1)
Returns the given block content in its native SWIFT format
|
static void |
writeBlock1(SwiftBlock1 b1,
java.io.Writer writer)
Write the given block to writer in its native SWIFT format
|
static java.lang.String |
writeBlock2(SwiftBlock2 b2)
Returns the given block content in its native SWIFT format
|
static void |
writeBlock2(SwiftBlock2 b2,
java.io.Writer writer)
Write the given block to writer in its native SWIFT format
|
static java.lang.String |
writeBlock3(SwiftBlock3 b3)
Returns the given block content in its native SWIFT format
|
static void |
writeBlock3(SwiftBlock3 b3,
java.io.Writer writer)
Write the given block to writer in its native SWIFT format
|
static java.lang.String |
writeBlock4(SwiftBlock4 b4)
Returns the given block content in its native SWIFT format
|
static void |
writeBlock4(SwiftBlock4 b4,
java.io.Writer writer)
Write the given block to writer in its native SWIFT format
|
static java.lang.String |
writeBlock5(SwiftBlock5 b5)
Returns the given block content in its native SWIFT format
|
static void |
writeBlock5(SwiftBlock5 b5,
java.io.Writer writer)
Write the given block to writer in its native SWIFT format
|
static void |
writeMessage(SwiftMessage msg,
java.io.Writer writer)
Writes the given message content to writer in its FIN format (raw SWIFT format for MT messages).
|
static void |
writeMessage(SwiftMessage msg,
java.io.Writer writer,
boolean ignoreEmptyBlocks)
Writes the given message content to writer in its FIN format (raw SWIFT format for MT messages), controlling how
to handle empty blocks.
|
static void |
writeMessage(SwiftMessage msg,
java.io.Writer writer,
boolean ignoreEmptyBlocks,
boolean trimTagValues)
Writes the given message content to writer in its FIN format (raw SWIFT format for MT messages), controlling how
to handle empty blocks and spaces in field values.
|
public static void writeMessage(SwiftMessage msg, java.io.Writer writer)
This method call will preserve and write empty blocks present in the message parameter, and also any
starting or trailing spaces in the field values. For a fine-grain control on how to handle empty blocks and
spaces in field values use writeMessage(SwiftMessage, Writer, boolean, boolean)
.
As for the EOL characters, they are written as found in the message content. You can always write into String
and use ensureEols(String)
on the result if you need to ensure compliance with SWIFT.
msg
- the message to writewriter
- the writer that will actually receive all the write operationsjava.lang.IllegalArgumentException
- if msg or writer are nullpublic static void writeMessage(SwiftMessage msg, java.io.Writer writer, boolean ignoreEmptyBlocks)
Starting and trailing spaces in field values will be preserve. For a fine-grain control on how to handle
spaces in field values use writeMessage(SwiftMessage, Writer, boolean, boolean)
.
As for the EOL characters, they are written as found in the message content. You can always write into String
and use ensureEols(String)
on the result if you need to ensure compliance with SWIFT.
msg
- the message to writewriter
- the writer that will actually receive all the write operationsignoreEmptyBlocks
- if true, empty blocks will not be writtenjava.lang.IllegalArgumentException
- if msg or writer are nullpublic static void writeMessage(SwiftMessage msg, java.io.Writer writer, boolean ignoreEmptyBlocks, boolean trimTagValues)
msg
- the message to writewriter
- the writer that will actually receive all the write operationsignoreEmptyBlocks
- if true, empty blocks will not be writtentrimTagValues
- if true, starting and trailing spaces in field values will be trimmed.java.lang.IllegalArgumentException
- if msg or writer are nullpublic static java.lang.String getInternalXml(SwiftMessage msg)
msg
- the message to writejava.lang.IllegalArgumentException
- if msg is nullpublic static void writeBlock1(SwiftBlock1 b1, java.io.Writer writer)
b1
- a not null block 1public static java.lang.String writeBlock1(SwiftBlock1 b1)
b1
- a not null block 1public static void writeBlock2(SwiftBlock2 b2, java.io.Writer writer)
b2
- a not null block 2public static java.lang.String writeBlock2(SwiftBlock2 b2)
b2
- a not null block 2public static void writeBlock3(SwiftBlock3 b3, java.io.Writer writer)
b3
- a not null block 3public static java.lang.String writeBlock3(SwiftBlock3 b3)
b3
- a not null block 3public static void writeBlock4(SwiftBlock4 b4, java.io.Writer writer)
b4
- a not null block 4public static java.lang.String writeBlock4(SwiftBlock4 b4)
b4
- a not null block 4public static void writeBlock5(SwiftBlock5 b5, java.io.Writer writer)
b5
- a not null block 5public static java.lang.String writeBlock5(SwiftBlock5 b5)
b5
- a not null block 5public static java.lang.String ensureEols(java.lang.String content)
content
- the complete or partial FIN text to process