datasource
Class FileSource

java.lang.Object
  extended by datasource.DataSource
      extended by datasource.FileSource

public class FileSource
extends DataSource

A FileSource is a source that reads a file (sequentially);

Version:
$Id: FileSource.java,v 1.7 2010/01/05 19:02:15 zahorjan Exp $

Field Summary
(package private)  java.io.FileInputStream file
          The file object to read from.
(package private)  java.lang.String filename
          The name of the file to read.
 
Fields inherited from class datasource.DataSource
CLOSED, CONNECTED, STARTING, state
 
Constructor Summary
FileSource(java.lang.String fname)
          Open file for reading.
 
Method Summary
private  void close()
          Private function to close the file source.
protected  int readFromSrc(byte[] buf, int len)
          Perform actual read from file.
 void reInit()
          (Re)Initialize this object.
 
Methods inherited from class datasource.DataSource
read, readyToRead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filename

java.lang.String filename
The name of the file to read.


file

java.io.FileInputStream file
The file object to read from.

Constructor Detail

FileSource

public FileSource(java.lang.String fname)
Open file for reading.

Method Detail

reInit

public void reInit()
            throws java.io.IOException,
                   java.io.FileNotFoundException
(Re)Initialize this object.

Specified by:
reInit in class DataSource
Throws:
java.io.IOException
java.io.FileNotFoundException

readFromSrc

protected int readFromSrc(byte[] buf,
                          int len)
                   throws java.io.IOException
Perform actual read from file.

Specified by:
readFromSrc in class DataSource
Throws:
java.io.IOException

close

private void close()
            throws java.io.IOException
Private function to close the file source.

Throws:
java.io.IOException