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
NetricsFileFormatException
NetricsRecFile
public NetricsCSVRecSrc(java.io.BufferedReader in_stream, NetricsRecFile file_spec) throws NetricsFileFormatException, java.io.FileNotFoundException
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
java.io.FileNotFoundException
NetricsRecFile
public java.lang.String[] getFieldNames()
public int[] getFieldTypes()
public 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 NetricsRecSrc
NetricsFileFormatException
public NetricsRecord getNext() throws NetricsFileFormatException
getNext
in interface NetricsRecSrc
NetricsFileFormatException
public void reset() throws NetricsFileFormatException
reset
in interface NetricsRecSrc
NetricsFileFormatException
public void close() throws NetricsFileFormatException
NetricsFileFormatException