Package com.prowidesoftware.swift.io
Class RJEReader
- java.lang.Object
-
- com.prowidesoftware.swift.io.AbstractReader
-
- com.prowidesoftware.swift.io.RJEReader
-
- All Implemented Interfaces:
java.lang.Iterable<java.lang.String>
,java.util.Iterator<java.lang.String>
public class RJEReader extends AbstractReader
Helper class to read RJE files.File content is splitted, and the iterator returns the raw message content of each SWIFT message found in the file. API is also provided to read each message parsed into an MT..
The reader can be created from a String but also from a Reader, File or Stream; thus when used as an iterator you can iterate it just once, it is not re-entrant.
- Since:
- 7.8
-
-
Field Summary
Fields Modifier and Type Field Description static char
SPLITCHAR
-
Fields inherited from class com.prowidesoftware.swift.io.AbstractReader
reader
-
-
Constructor Summary
Constructors Constructor Description RJEReader(java.io.File file)
RJEReader(java.io.File _file, java.nio.charset.Charset _charset)
Constructs aRJEReader
to read messages from a file using the specified charset.RJEReader(java.io.InputStream stream)
RJEReader(java.io.InputStream _stream, java.nio.charset.Charset _charset)
Constructs aRJEReader
to read messages from an input stream using the specified charset.RJEReader(java.io.Reader r)
Constructs a RJEReader to read messages from a given Reader instanceRJEReader(java.lang.String string)
Constructs a RJEReader to read messages from a string
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
Returns true if the iterator has more messages.java.lang.String
next()
Returns the next message in the iterator in its raw formatvoid
setSplitChar(char c)
Overwrites the default standard split charSPLITCHAR
-
Methods inherited from class com.prowidesoftware.swift.io.AbstractReader
iterator, nextMT, nextSwiftMessage
-
-
-
-
Field Detail
-
SPLITCHAR
public static final char SPLITCHAR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RJEReader
public RJEReader(java.io.Reader r)
Constructs a RJEReader to read messages from a given Reader instance
-
RJEReader
public RJEReader(java.lang.String string)
Constructs a RJEReader to read messages from a string
-
RJEReader
public RJEReader(java.io.InputStream stream)
-
RJEReader
public RJEReader(java.io.InputStream _stream, java.nio.charset.Charset _charset)
Constructs aRJEReader
to read messages from an input stream using the specified charset.- Parameters:
_stream
- stream to read_charset
- charset
-
RJEReader
public RJEReader(java.io.File file) throws java.io.FileNotFoundException
- Throws:
java.io.FileNotFoundException
-
RJEReader
public RJEReader(java.io.File _file, java.nio.charset.Charset _charset) throws java.io.FileNotFoundException
Constructs aRJEReader
to read messages from a file using the specified charset.- Parameters:
_file
- file to read_charset
- charset- Throws:
java.io.FileNotFoundException
- if file does not exist
-
-
Method Detail
-
hasNext
public boolean hasNext()
Returns true if the iterator has more messages. If the RJE file ends with a separator, this will return true, meaning the iteration will return a blank message at the end.- Specified by:
hasNext
in interfacejava.util.Iterator<java.lang.String>
- Specified by:
hasNext
in classAbstractReader
-
next
public java.lang.String next()
Returns the next message in the iterator in its raw format- Specified by:
next
in interfacejava.util.Iterator<java.lang.String>
- Specified by:
next
in classAbstractReader
-
setSplitChar
public void setSplitChar(char c)
Overwrites the default standard split charSPLITCHAR
- Parameters:
c
- a character to use as message separator- Since:
- 7.9.7
-
-