net.sf.xbus.technical.file
Class FileLineReader

java.lang.Object
  extended by java.io.Reader
      extended by java.io.BufferedReader
          extended by net.sf.xbus.technical.file.FileLineReader
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable, LineReader

public class FileLineReader
extends java.io.BufferedReader
implements LineReader

LineReader to read/send a character stream from/to a file.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
FileLineReader(java.io.File sourceFile, java.lang.String encoding)
           
 
Method Summary
 void prepareReading(XBUSSystem destination)
          Initialization to be done before reading from the LineReader.
 java.lang.String readRecord()
          readRecord is called by senders to read the incoming data line by line.
 void terminateReading()
          Cleanup to be done after reading from the LineReader, e.g. closing an InputStream.
 
Methods inherited from class java.io.BufferedReader
close, mark, markSupported, read, read, readLine, ready, reset, skip
 
Methods inherited from class java.io.Reader
read, read
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileLineReader

public FileLineReader(java.io.File sourceFile,
                      java.lang.String encoding)
               throws java.io.UnsupportedEncodingException,
                      java.io.FileNotFoundException
Throws:
java.io.UnsupportedEncodingException
java.io.FileNotFoundException
Method Detail

prepareReading

public void prepareReading(XBUSSystem destination)
                    throws XException
Description copied from interface: LineReader
Initialization to be done before reading from the LineReader.

Specified by:
prepareReading in interface LineReader
Throws:
XException - if something goes wrong

readRecord

public java.lang.String readRecord()
                            throws XException
Description copied from interface: LineReader
readRecord is called by senders to read the incoming data line by line.

Specified by:
readRecord in interface LineReader
Returns:
null if there is no more line
Throws:
XException - if something goes wrong

terminateReading

public void terminateReading()
                      throws XException
Description copied from interface: LineReader
Cleanup to be done after reading from the LineReader, e.g. closing an InputStream.

Specified by:
terminateReading in interface LineReader
Throws:
XException - if something goes wrong