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 String
This member represents the input filenameprotected FileInputStream
This member represents the input stream to read from.protected BufferedReader
This member is actually used for reading data.protected COSARReporter
This member is used for reporting.Fields inherited from interface com.nt.udc.io.IDataSource
EOF
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
end()
This function is called to end reading.protected void
boolean
boolean
This function is called to initialize the data source.boolean
char
nextChar()
int
read
(char[] buf, int len) This function reads a given number of characters from the source.boolean
setBookmark
(int lineNo) This function is called to mark a certain position in the input stream.void
setReporter
(COSARReporter reporter) boolean
start()
This function is called to start reading.boolean
This 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:
getSourceName
in interfaceIDataSource
- Returns:
- The name of the source.
-
hasMoreData
public boolean hasMoreData()- Specified by:
hasMoreData
in interfaceIDataSource
- Returns:
- true if more input is available.
-
nextChar
- Specified by:
nextChar
in 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:IDataSource
This function reads a given number of characters from the source.- Specified by:
read
in interfaceIDataSource
- 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 interfaceIDataSource
-
terminate
public boolean terminate()Description copied from interface:IDataSource
This function is called to terminate the data source.- Specified by:
terminate
in interfaceIDataSource
-
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 interfaceIDataSource
- 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 interfaceIDataSource
- 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 interfaceIDataSource
-
isHealthy
public boolean isHealthy()- Specified by:
isHealthy
in interfaceIDataSource
- Returns:
- true if the data source is OK, false otherwise.
-
error
-