org.jmonks.batch.io.flat
Class FixedWidthFlatFileReader

java.lang.Object
  extended byorg.jmonks.batch.io.FileReader
      extended byorg.jmonks.batch.io.flat.FlatFileReader
          extended byorg.jmonks.batch.io.flat.FixedWidthFlatFileReader

public class FixedWidthFlatFileReader
extends FlatFileReader

FixedWidthFlatFileReader reads the specified fixed width flat file according to the given file spec and returns the recrods on the needed basis. Each field value from the record should be read using readField method by passing the fieldName mentioned in the file spec. To find out how to read each record from the file and to read the each field from the record, refer to the FileReader javadoc.

Since:
1.0
Version:
1.0
Author:
Suresh Pragada

Nested Class Summary
 
Nested classes inherited from class org.jmonks.batch.io.flat.FlatFileReader
FlatFileReader.FlatFileReaderRecord
 
Field Summary
 
Fields inherited from class org.jmonks.batch.io.flat.FlatFileReader
fileSpec
 
Constructor Summary
FixedWidthFlatFileReader(java.io.InputStream fileInputStream, FileSpec fileSpec)
          Constructs and initializes the reader with the given file path and file spec.
FixedWidthFlatFileReader(java.io.Reader reader, FileSpec fileSpec)
          Constructs and initializes the reader with the given file path and file spec.
 
Method Summary
protected  ReaderRecord parseRecord(java.lang.String recordString)
          Parses the given record string, translates it into the proper ReaderRecord and returns the reader record.
 
Methods inherited from class org.jmonks.batch.io.flat.FlatFileReader
close, getNextRecord
 
Methods inherited from class org.jmonks.batch.io.FileReader
getFileReader, getFileReader, getFileReader, getFileReader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedWidthFlatFileReader

public FixedWidthFlatFileReader(java.io.InputStream fileInputStream,
                                FileSpec fileSpec)
Constructs and initializes the reader with the given file path and file spec.

Parameters:
fileInputStream - Input stream to the file.
fileSpec - File spec to be used to read the file.

FixedWidthFlatFileReader

public FixedWidthFlatFileReader(java.io.Reader reader,
                                FileSpec fileSpec)
Constructs and initializes the reader with the given file path and file spec.

Parameters:
reader - Reader to the file.
fileSpec - File spec to be used to read the file.
Method Detail

parseRecord

protected ReaderRecord parseRecord(java.lang.String recordString)
Parses the given record string, translates it into the proper ReaderRecord and returns the reader record.

Specified by:
parseRecord in class FlatFileReader
Parameters:
recordString - Record read from the file.
Throws:
FileParseException - Problems while parsing the next record. This includes unable to identify the recod with the availble record specs.