|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.prowidesoftware.swift.io.parser.SwiftParser
public class SwiftParser
FIN Parser. This implementation now properly supports all system messages (i.e: messages for MT 0xx) and
service messages (for example: ACK).
As part of this, the following is now also accepted:
Field Summary | |
---|---|
static java.lang.String |
EOL
Helper constant with the content of System.getProperty("line.separator", "\n") |
Constructor Summary | |
---|---|
SwiftParser()
default constructor. NOTE: If this constructor is called, setReader must be called to use the parser |
|
SwiftParser(java.io.InputStream is)
Constructor with an input stream for parsing a message |
|
SwiftParser(java.io.Reader r)
Constructor with a reader for parsing a message |
|
SwiftParser(java.lang.String message)
Constructor with a reader for parsing a message |
Method Summary | |
---|---|
protected SwiftBlock4 |
block4Consume(SwiftBlock4 b,
java.lang.String s)
Parses a block 4 from an input string. |
protected SwiftBlock |
consumeBlock()
Consume the next block of the message on the reader. |
protected Tag |
consumeTag(java.lang.String buffer,
java.lang.String unparsedText)
Process the input as a tag. |
protected void |
findBlockStart()
read on the reader until a block start character or EOF is reached. |
java.util.List |
getErrors()
Get a copy of the errors found. |
protected char |
identifyBlock(java.lang.String s)
Identify the block to be consumed. |
SwiftMessage |
message()
Parse a SWIFT message into a data structure |
SwiftMessage |
parse(java.lang.String message)
Sets the parameter string as this parser data and returns the parsed object. |
protected java.lang.String |
readUntilBlockEnds()
Reads the buffer until end of block is reached. |
void |
setData(java.lang.String data)
sets the input data to the received string. |
void |
setReader(java.io.Reader r)
sets the input reader. NOTE: this resets the internal buffer |
protected SwiftTagListBlock |
tagListBlockConsume(SwiftTagListBlock b,
java.lang.String s)
consumes a tag list block (i.e: block 3, block 5 or user defined block) |
protected int |
textTagEndBlock4(java.lang.String s,
int start,
boolean isTextBlock)
finds the end of a text tag (i.e: ":TAG:VALUE"). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String EOL
System.getProperty("line.separator", "\n")
Constructor Detail |
---|
public SwiftParser(java.io.InputStream is)
is
- stream to readpublic SwiftParser(java.io.Reader r)
r
- the Reader with the swift message to readpublic SwiftParser(java.lang.String message)
message
- the String with the swift message to readpublic SwiftParser()
Method Detail |
---|
public void setReader(java.io.Reader r)
r
- the reader to usepublic void setData(java.lang.String data)
data
- the data to use as inputpublic SwiftMessage message() throws java.io.IOException
java.io.IOException
public SwiftMessage parse(java.lang.String message) throws java.io.IOException
message
- the String with the swift message to parse
java.io.IOException
protected SwiftBlock consumeBlock() throws java.io.IOException
blockHint
-
null
if none was found (i.e: end of input)
java.io.IOException
- if an error occurred during readprotected SwiftTagListBlock tagListBlockConsume(SwiftTagListBlock b, java.lang.String s) throws java.io.IOException
b
- the block to set up tags intos
- the block data to process
java.io.IOException
protected SwiftBlock4 block4Consume(SwiftBlock4 b, java.lang.String s) throws java.io.IOException
b
- the block to set up tags intos
- the block data to process
java.io.IOException
protected int textTagEndBlock4(java.lang.String s, int start, boolean isTextBlock)
s
- the FIN input textstart
- the position to start analysis at
protected Tag consumeTag(java.lang.String buffer, java.lang.String unparsedText) throws java.io.IOException
buffer
- the buffer containing the tagunparsedText
- the unparsed text to assign (use null
if none is wanted).
This single text is fragmented in multiple texts if there are more than one message.
java.io.IOException
protected char identifyBlock(java.lang.String s)
s
- the block identifier
protected java.lang.String readUntilBlockEnds() throws java.io.IOException
This method assumes that the starting block character was consumed because that is required in order to identify the start of a block, and call this method which reads until this block ends.
java.io.IOException
protected void findBlockStart() throws java.io.IOException
java.io.IOException
- if thrown during readpublic java.util.List getErrors()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |