public abstract class FormatReader<H extends FormatHeader>
extends java.lang.Object
implements java.io.Closeable
Modifier | Constructor and Description |
---|---|
protected |
FormatReader(java.lang.String filename) |
Modifier and Type | Method and Description |
---|---|
static FormatReader |
createFormatReader(java.lang.String... fileSpec)
This method selects the appropriate FormatReader class.
|
protected FormatField |
getField(int fieldIndex)
This method returns the field information provided by the header.
|
int |
getFieldCount()
This method returns the number of fields of this file.
|
java.lang.String |
getFilename()
This method returns the name of the file this reader is supposed to read.
|
H |
getHeader()
This method returns the header of the file that is to be read.
|
int |
getRecordCount()
This method returns the number of records that contains the file read by the FormatReader instance.
|
protected boolean |
isSystemResource()
This method returns true if the reader is based on a system resource or false otherwise.
|
java.lang.Object[] |
nextRecord()
This method returns the next record in the file.
|
abstract java.lang.Object[] |
nextRecord(int skipThisNumberOfLines)
This method skips some lines and then reads a record in the file;
|
protected java.io.InputStream |
openStream()
This method opens the stream depending on its nature (a resource or a file)
|
protected void |
setFormatHeader(H header) |
protected FormatReader(java.lang.String filename) throws java.io.IOException
java.io.IOException
protected java.io.InputStream openStream() throws java.io.IOException
java.io.IOException
public int getRecordCount()
protected FormatField getField(int fieldIndex)
fieldIndex
- the index of the fieldpublic int getFieldCount()
public java.lang.Object[] nextRecord() throws java.io.IOException
java.io.IOException
public abstract java.lang.Object[] nextRecord(int skipThisNumberOfLines) throws java.io.IOException
skipThisNumberOfLines
- the number of lines to skip before reading the observationjava.io.IOException
public static FormatReader createFormatReader(java.lang.String... fileSpec) throws java.io.IOException
fileSpec
- a list of specification for the file to open (e.g. the filename, the table, etc...)java.io.IOException
public H getHeader()
protected void setFormatHeader(H header)
public java.lang.String getFilename()
protected boolean isSystemResource()