public class NetricsCSVRecSrc extends java.lang.Object implements NetricsRecSrc
NetricsRecFile| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DFLT_CHARSET
Default file character set encoding (latin-1).
|
| Constructor and Description |
|---|
NetricsCSVRecSrc(java.io.BufferedReader in_stream,
NetricsRecFile file_spec)
Create a record reader for a CSV file read from a stream.
|
NetricsCSVRecSrc(NetricsRecFile file_spec)
Create a record reader for a CSV file.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes files opened by this object.
|
int |
getCount()
Return the number of records returned so far.
|
int |
getCurLine()
Return the line number of the last line read.
|
java.lang.String[] |
getFieldNames()
Return the record field names.
|
int[] |
getFieldTypes()
Return the record field types.
|
NetricsRecord |
getNext()
Return the next valid CSV record.
|
int |
getRecLine()
Return the line number the last record returned started on.
|
boolean |
hasNext()
Return true if there is another record to be read.
|
void |
loggingOff()
Turn logging of Ignored records off.
|
void |
loggingOn(java.io.Writer log_file)
Turn logging of Ignored bad records on.
|
void |
reset()
Reset the file to the first record.
|
public static final java.lang.String DFLT_CHARSET
public NetricsCSVRecSrc(NetricsRecFile file_spec) throws java.io.FileNotFoundException, NetricsFileFormatException
file_spec - The definition of the location and format of the
CSV file containing the records to be read.java.io.FileNotFoundException - if the file specified in file_spec does
not exist.NetricsFileFormatException - if the file specified in file_spec
has improperly formatted data.NetricsRecFilepublic NetricsCSVRecSrc(java.io.BufferedReader in_stream,
NetricsRecFile file_spec)
throws NetricsFileFormatException
in_stream - The input stream the CSV data is to be read from.file_spec - The definition of the format of the
CSV file containing the records to be read.NetricsFileFormatException - if the input stream has improperly
formatted data.NetricsRecFilepublic java.lang.String[] getFieldNames()
public int[] getFieldTypes()
NetricsTablepublic int getCurLine()
public int getRecLine()
public int getCount()
public void loggingOn(java.io.Writer log_file)
log_file - a line is written to this file for each bad record
that is ignored.public void loggingOff()
public boolean hasNext()
throws NetricsFileFormatException
hasNext in interface NetricsBaseRecSrcNetricsFileFormatExceptionpublic NetricsRecord getNext() throws NetricsFileFormatException
getNext in interface NetricsBaseRecSrcgetNext in interface NetricsRecSrcNetricsFileFormatExceptionpublic void reset()
throws NetricsFileFormatException
reset in interface NetricsBaseRecSrcNetricsFileFormatExceptionpublic void close()
throws NetricsFileFormatException
NetricsFileFormatException - if there was an error closing
the underlying stream.