ibi Patterns .NET API
Loading...
Searching...
No Matches
NetricsServerInterface.NetricsCSVRecSrc Class Reference

NetricsTableRecSrc implementation for CSV file records. More...

Public Member Functions

void  loggingOn (StreamWriter log_file)
  Turn logging of Ignored bad records on.
 
void  loggingOff ()
  Turn logging of Ignored bad records off.
 
  NetricsCSVRecSrc (NetricsRecFile file_spec)
  Create CSV Record reader from a File definition object.
 
  NetricsCSVRecSrc (StreamReader instream, NetricsRecFile file_spec)
  Create CSV Record reader for an input stream from a File definition object.
 
  NetricsCSVRecSrc (String filename, int recKeyFieldNum, Encoding encoding)
  Obsolete. Use.
 
  NetricsCSVRecSrc (String filename, int recKeyFieldNum)
  Obsolete. Use.
 
  NetricsCSVRecSrc (String filename)
  Obsolete. use.
 
String[]  getFieldNames ()
  Return the field names of the record data fields.
 
int[]  getFieldTypes ()
  Return the field types of the record data fields.
 
override bool  hasNext ()
  Return true if there is another record to read.
 
override NetricsRecord  getNext ()
  Returns the next valid CSV record.
 
override void  reset ()
  Reset the read back to the begining of the file.
 
int  getCurLine ()
  Get the line number of the last line read.
 
int  getRecLine ()
  Get the line the last record read started on.
 
int  getCount ()
  Gets count of records output so far.
 
void  close ()
  Closes files opened by this object.
 
void  Dispose ()
  Clean up attached resources.
 
abstract NetricsRecord  getNext ()
  Returns the next record.
 
abstract bool  hasNext ()
  Returns true if the source has more records.
 
abstract void  reset ()
  Reset the source to the first record.
 
bool  hasNext ()
  Returns true if the source has more records.
 
NetricsBaseRecord  getNext ()
  Returns the next record.
 
void  reset ()
  Reset the source to the first record.
 

Detailed Description

NetricsTableRecSrc implementation for CSV file records.

This implements the NetricsTableRecSrc interface for CSV format files. It reads CSV format records and converts them into NetricsRecord objects. It handles the same CSV format, including various variety of header records and record keys, as the server side read of CSV record data. See NetricsRecFile for more info on CSV formats.

Constructor & Destructor Documentation

◆ NetricsCSVRecSrc() [1/5]

NetricsServerInterface.NetricsCSVRecSrc.NetricsCSVRecSrc ( NetricsRecFile  file_spec )
inline

Create CSV Record reader from a File definition object.

Parameters
file_spec Defines file and file format.
See also
NetricsRecFile

◆ NetricsCSVRecSrc() [2/5]

NetricsServerInterface.NetricsCSVRecSrc.NetricsCSVRecSrc ( StreamReader  instream,
NetricsRecFile  file_spec 
)
inline

Create CSV Record reader for an input stream from a File definition object.

Parameters
instream Stream CSV data is read from.
file_spec Defines file format. File name is ignored.
See also
NetricsRecFile

◆ NetricsCSVRecSrc() [3/5]

NetricsServerInterface.NetricsCSVRecSrc.NetricsCSVRecSrc ( String  filename,
int  recKeyFieldNum,
Encoding  encoding 
)
inline

Obsolete. Use.

NetricsCSVRecSrc(new NetricsRecFile(file,recKeyFieldNum)) instead.

Parameters
filename The name of the file containing the records.
recKeyFieldNum The index (zero based) of the field.
encoding The character encoding of the CSV file.
Deprecated:
{}

◆ NetricsCSVRecSrc() [4/5]

NetricsServerInterface.NetricsCSVRecSrc.NetricsCSVRecSrc ( String  filename,
int  recKeyFieldNum 
)
inline

Obsolete. Use.

NetricsCSVRecSrc(new NetricsRecFile(file,recKeyFieldNum)) instead.

Parameters
filename The name of the file containing the records.
recKeyFieldNum The index (zero based) of the field that contains the record key.

◆ NetricsCSVRecSrc() [5/5]

NetricsServerInterface.NetricsCSVRecSrc.NetricsCSVRecSrc ( String  filename )
inline

Obsolete. use.

NetricsCSVRecSrc(new NetricsRecFile(file)) instead.

Parameters
filename The name of the file containing the records.

Member Function Documentation

◆ close()

void NetricsServerInterface.NetricsCSVRecSrc.close ( )
inline

Closes files opened by this object.

This closes and cleans up any files opened by this object. If a stream was passed in when this object was created/initialized calling this method will result in a thrown exception.

◆ Dispose()

void NetricsServerInterface.NetricsCSVRecSrc.Dispose ( )
inline

Clean up attached resources.

Cleans up any resources owned by this object.

◆ getFieldNames()

String[] NetricsServerInterface.NetricsCSVRecSrc.getFieldNames ( )
inline

Return the field names of the record data fields.

This returns the field names for the record data fields as given in the CSV file header. This does not include the key field if it exists. If no field names are given in the header this is null.

◆ getFieldTypes()

int[] NetricsServerInterface.NetricsCSVRecSrc.getFieldTypes ( )
inline

Return the field types of the record data fields.

This returns the field types for the record data fields as given in the CSV file header. This does not include the key field if it exists.

The integer values returned are the field type integer ID as defined in NetricsTable.

If no field types are given in the header this is null.

See also
NetricsTable

◆ getNext()

override NetricsRecord NetricsServerInterface.NetricsCSVRecSrc.getNext ( )
inlinevirtual

Returns the next valid CSV record.

This returns the next valid CSV record. If the end of file is reached it returns null.

If Do Max Work is specified invalid records are quietly skipped. If Do Max Work is not specified invalid records throw an exception.

Implements NetricsServerInterface.NetricsTableRecSrc.

◆ loggingOff()

void NetricsServerInterface.NetricsCSVRecSrc.loggingOff ( )
inline

Turn logging of Ignored bad records off.

This does not close the log file, the caller is responible for managing the log file.

◆ loggingOn()

void NetricsServerInterface.NetricsCSVRecSrc.loggingOn ( StreamWriter  log_file )
inline

Turn logging of Ignored bad records on.

This turns on logging of bad records that were ignored. This is only relevant if the Do Max Work flag is set. If logging is already on this call will change the log file.

Parameters
log_file an open StreamWriter object, a message is written to this file for each bad record that is ignored.

◆ reset()

override void NetricsServerInterface.NetricsCSVRecSrc.reset ( )
inlinevirtual

Reset the read back to the begining of the file.

This resets the read point back to the first record in the file. If a StreamReader was passed in rather than a file name this throws an exception.

Implements NetricsServerInterface.NetricsTableRecSrc.