Class PPCReader

  • All Implemented Interfaces:
    java.lang.Iterable<java.lang.String>, java.util.Iterator<java.lang.String>

    public class PPCReader
    extends AbstractReader
    Helper class to read the legacy DOS-PCC files.

    File content is split, 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
    • Constructor Summary

      Constructors 
      Constructor Description
      PPCReader​(java.io.File file)  
      PPCReader​(java.io.File _file, java.nio.charset.Charset _charset)
      Constructs a PPCReader to read messages from a file using the specified charset.
      PPCReader​(java.io.InputStream stream)  
      PPCReader​(java.io.InputStream _stream, java.nio.charset.Charset _charset)
      Constructs a PPCReader to read messages from an input stream using the specified charset.
      PPCReader​(java.io.Reader r)
      Constructs a PPCReader to read messages from a given Reader instance
      PPCReader​(java.lang.String string)
      Constructs a PPCReader 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 format
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, remove
    • Constructor Detail

      • PPCReader

        public PPCReader​(java.io.Reader r)
        Constructs a PPCReader to read messages from a given Reader instance
      • PPCReader

        public PPCReader​(java.lang.String string)
        Constructs a PPCReader to read messages from a string
      • PPCReader

        public PPCReader​(java.io.InputStream stream)
      • PPCReader

        public PPCReader​(java.io.InputStream _stream,
                         java.nio.charset.Charset _charset)
        Constructs a PPCReader to read messages from an input stream using the specified charset.
        Parameters:
        _stream - stream to read
        _charset - charset
      • PPCReader

        public PPCReader​(java.io.File file)
                  throws java.io.FileNotFoundException
        Throws:
        java.io.FileNotFoundException
      • PPCReader

        public PPCReader​(java.io.File _file,
                         java.nio.charset.Charset _charset)
                  throws java.io.FileNotFoundException
        Constructs a PPCReader 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
        Specified by:
        hasNext in interface java.util.Iterator<java.lang.String>
        Specified by:
        hasNext in class AbstractReader
      • next

        public java.lang.String next()
        Returns the next message in the iterator in its raw format
        Specified by:
        next in interface java.util.Iterator<java.lang.String>
        Specified by:
        next in class AbstractReader