net.bzzt.swift.mt940.parser
Class Mt940Parser

java.lang.Object
  extended by net.bzzt.swift.mt940.parser.Mt940Parser

public class Mt940Parser
extends java.lang.Object

Author:
Arnout Engelen, Miroslav Holubec

Constructor Summary
Mt940Parser()
           
 
Method Summary
private  java.util.List<java.lang.String> mergeLines(java.util.List<java.lang.String> recordLines)
          An mt940-record first has a couple of 'header' lines that do not start with a ':'.
 Mt940File parse(java.io.LineNumberReader reader)
          Parse the Mt940-file.
private  java.lang.String parseBetrag(Mt940Entry currentEntry, java.lang.String line)
          Parse the value, put it into the entry.
private  java.lang.String parseDatumJJMMTT(Mt940Entry currentEntry, java.lang.String string)
          Parse the JJMMTT-formatted date, put it into the entry.
private  Mt940Record parseRecord(java.util.List<java.lang.String> recordLines)
          An mt940-record consists of some general lines and a couple of entries consisting of a :61: and a :86:-section.
private  java.lang.String parseSollHabenKennung(Mt940Entry currentEntry, java.lang.String string)
          Parse the debet/credit value, put it into the entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mt940Parser

public Mt940Parser()
Method Detail

parse

public Mt940File parse(java.io.LineNumberReader reader)
                throws java.io.IOException,
                       java.text.ParseException
Parse the Mt940-file. Mt940 records are delimited by '-'.

Parameters:
reader -
Returns:
Mt940File instance
Throws:
java.io.IOException
java.text.ParseException

mergeLines

private java.util.List<java.lang.String> mergeLines(java.util.List<java.lang.String> recordLines)
An mt940-record first has a couple of 'header' lines that do not start with a ':'. After that, a line that doesn't start with a ':' is assumed to belong to the previous 'real' line.

Returns:

parseRecord

private Mt940Record parseRecord(java.util.List<java.lang.String> recordLines)
                         throws java.text.ParseException
An mt940-record consists of some general lines and a couple of entries consisting of a :61: and a :86:-section.

Parameters:
recordLines -
Returns:
Throws:
java.text.ParseException

parseBetrag

private java.lang.String parseBetrag(Mt940Entry currentEntry,
                                     java.lang.String line)
Parse the value, put it into the entry.

Returns:
the rest of the string to be parsed

parseSollHabenKennung

private java.lang.String parseSollHabenKennung(Mt940Entry currentEntry,
                                               java.lang.String string)
Parse the debet/credit value, put it into the entry.

Returns:
the rest of the string to be parsed

parseDatumJJMMTT

private java.lang.String parseDatumJJMMTT(Mt940Entry currentEntry,
                                          java.lang.String string)
                                   throws java.text.ParseException
Parse the JJMMTT-formatted date, put it into the entry.

Returns:
the rest of the string to be parsed
Throws:
java.text.ParseException