Package com.nt.udc.io

Class CDataSourceSingleFile

java.lang.Object
com.nt.udc.io.CDataSourceSingleFile
All Implemented Interfaces:
IDataSource

public class CDataSourceSingleFile extends Object implements IDataSource
This class represents data sources consisting of individual files.
  • Field Details

    • m_filename

      protected String m_filename
      This member represents the input filename
    • m_inputStream

      protected FileInputStream m_inputStream
      This member represents the input stream to read from.
    • m_reader

      protected BufferedReader m_reader
      This member is actually used for reading data.
    • m_reporter

      protected COSARReporter m_reporter
      This member is used for reporting.
  • Constructor Details

  • Method Details

    • getReporter

      public COSARReporter getReporter()
    • setReporter

      public void setReporter(COSARReporter reporter)
    • getSourceName

      public String getSourceName()
      Specified by:
      getSourceName in interface IDataSource
      Returns:
      The name of the source.
    • hasMoreData

      public boolean hasMoreData()
      Specified by:
      hasMoreData in interface IDataSource
      Returns:
      true if more input is available.
    • nextChar

      public char nextChar() throws Exception
      Specified by:
      nextChar in interface IDataSource
      Returns:
      The next character from the input. If no more characters are available, IDataSource.EOF is returned instead.
      Throws:
      Exception
    • read

      public int read(char[] buf, int len) throws Exception
      Description copied from interface: IDataSource
      This function reads a given number of characters from the source.
      Specified by:
      read in interface IDataSource
      Returns:
      The number of characters actually read.
      Throws:
      Exception
    • initialize

      public boolean initialize()
      Description copied from interface: IDataSource
      This function is called to initialize the data source.
      Specified by:
      initialize in interface IDataSource
    • terminate

      public boolean terminate()
      Description copied from interface: IDataSource
      This function is called to terminate the data source.
      Specified by:
      terminate in interface IDataSource
    • start

      public boolean start()
      Description copied from interface: IDataSource
      This function is called to start reading. Classes implementing IDataSource may use it for initialization.
      Specified by:
      start in interface IDataSource
      Returns:
      true if successful, false otherwise
    • end

      public boolean end()
      Description copied from interface: IDataSource
      This function is called to end reading. Classes implementing IDataSource may use it for clean-up operations.
      Specified by:
      end in interface IDataSource
      Returns:
      true if successful, false otherwise
    • setBookmark

      public boolean setBookmark(int lineNo)
      Description copied from interface: IDataSource
      This function is called to mark a certain position in the input stream. This mark may be stored on a persistent medium in order to avoid re-reading the same data during the next reading session.
      Specified by:
      setBookmark in interface IDataSource
    • isHealthy

      public boolean isHealthy()
      Specified by:
      isHealthy in interface IDataSource
      Returns:
      true if the data source is OK, false otherwise.
    • error

      protected void error(String fName, String msg)