Package com.nt.udc.io
Class CDataSourceSingleFile
java.lang.Object
com.nt.udc.io.CDataSourceSingleFile
- All Implemented Interfaces:
IDataSource
This class represents data sources consisting of individual files.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThis member represents the input filenameprotected FileInputStreamThis member represents the input stream to read from.protected BufferedReaderThis member is actually used for reading data.protected COSARReporterThis member is used for reporting.Fields inherited from interface com.nt.udc.io.IDataSource
EOF -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanend()This function is called to end reading.protected voidbooleanbooleanThis function is called to initialize the data source.booleancharnextChar()intread(char[] buf, int len) This function reads a given number of characters from the source.booleansetBookmark(int lineNo) This function is called to mark a certain position in the input stream.voidsetReporter(COSARReporter reporter) booleanstart()This function is called to start reading.booleanThis function is called to terminate the data source.
-
Field Details
-
m_filename
This member represents the input filename -
m_inputStream
This member represents the input stream to read from. -
m_reader
This member is actually used for reading data. -
m_reporter
This member is used for reporting.
-
-
Constructor Details
-
CDataSourceSingleFile
- Throws:
Exception
-
-
Method Details
-
getReporter
-
setReporter
-
getSourceName
- Specified by:
getSourceNamein interfaceIDataSource- Returns:
- The name of the source.
-
hasMoreData
public boolean hasMoreData()- Specified by:
hasMoreDatain interfaceIDataSource- Returns:
- true if more input is available.
-
nextChar
- Specified by:
nextCharin interfaceIDataSource- Returns:
- The next character from the input. If no more characters are available, IDataSource.EOF is returned instead.
- Throws:
Exception
-
read
Description copied from interface:IDataSourceThis function reads a given number of characters from the source.- Specified by:
readin interfaceIDataSource- Returns:
- The number of characters actually read.
- Throws:
Exception
-
initialize
public boolean initialize()Description copied from interface:IDataSourceThis function is called to initialize the data source.- Specified by:
initializein interfaceIDataSource
-
terminate
public boolean terminate()Description copied from interface:IDataSourceThis function is called to terminate the data source.- Specified by:
terminatein interfaceIDataSource
-
start
public boolean start()Description copied from interface:IDataSourceThis function is called to start reading. Classes implementing IDataSource may use it for initialization.- Specified by:
startin interfaceIDataSource- Returns:
- true if successful, false otherwise
-
end
public boolean end()Description copied from interface:IDataSourceThis function is called to end reading. Classes implementing IDataSource may use it for clean-up operations.- Specified by:
endin interfaceIDataSource- Returns:
- true if successful, false otherwise
-
setBookmark
public boolean setBookmark(int lineNo) Description copied from interface:IDataSourceThis 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:
setBookmarkin interfaceIDataSource
-
isHealthy
public boolean isHealthy()- Specified by:
isHealthyin interfaceIDataSource- Returns:
- true if the data source is OK, false otherwise.
-
error
-