public abstract class AbstractReader
extends java.lang.Object
implements java.util.Iterator<java.lang.String>, java.lang.Iterable<java.lang.String>
Modifier and Type | Field and Description |
---|---|
protected java.io.Reader |
reader |
Constructor and Description |
---|
AbstractReader(java.io.File file)
Constructs a reader to read messages from a file
|
AbstractReader(java.io.InputStream stream)
Constructs a reader to read messages from a stream
|
AbstractReader(java.io.Reader r)
Constructs a reader to read messages from a given Reader instance
|
AbstractReader(java.lang.String string)
Constructs a reader to read messages from a string
|
Modifier and Type | Method and Description |
---|---|
abstract boolean |
hasNext() |
java.util.Iterator<java.lang.String> |
iterator() |
abstract java.lang.String |
next() |
AbstractMT |
nextMT()
Reads the next raw content from the iterator and returns the message parsed into an MT.
|
SwiftMessage |
nextSwiftMessage()
Reads the next raw content from the iterator and returns the message parsed as a generic SwiftMessage.
|
public AbstractReader(java.io.Reader r)
public AbstractReader(java.lang.String string)
java.lang.IllegalArgumentException
- if string is nullpublic AbstractReader(java.io.InputStream stream)
java.lang.IllegalArgumentException
- if stream is nullpublic AbstractReader(java.io.File file) throws java.io.FileNotFoundException
java.lang.IllegalArgumentException
- if file is nulljava.io.FileNotFoundException
public abstract java.lang.String next()
next
in interface java.util.Iterator<java.lang.String>
public abstract boolean hasNext()
hasNext
in interface java.util.Iterator<java.lang.String>
public java.util.Iterator<java.lang.String> iterator() throws java.lang.IllegalArgumentException
iterator
in interface java.lang.Iterable<java.lang.String>
java.lang.IllegalArgumentException
- if the iteration is attempted more than oncepublic AbstractMT nextMT() throws java.io.IOException
IMPORTANT:
Since MTnnn model classes are implemented only for system and user-to-user messages (categories 0 to 9) if an
ACK/NAK (service id 21) message is found, the MT following the system message is returned (not the ACK/NAK).
For other service messages (login, select, quit) this method will return null because there is no MT
representation to create.
If you need to deal with all type of messages (including service, system and user-to-user) you can use
nextSwiftMessage()
instead.
java.io.IOException
- if the message content cannot be parsed into an MTpublic SwiftMessage nextSwiftMessage() throws java.io.IOException
java.io.IOException
- if the message content cannot be parsed into a SwiftMessage