|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mbari.io.FlatFileReader
Constructors initialize memory only, to actually read the data file call the
readFile method. This is done because some data files are very large (
~100MB) and reading them may take awhile. This allows a programmer to
specify when the big performance hit occurs.
FlatFileReader is meant for files with equal numbers of values on each line.
Lines that do not have the same number of values are ignored. It currently
assumes that the most commonly occuring number of values on a line is the
correct number of values.
Lines with the first charater of '#' or '%' are assumed to be comments
| Field Summary | |
protected double[][] |
data
Description of the Field |
protected java.io.File |
file
Description of the Field |
| Constructor Summary | |
FlatFileReader(java.io.File f)
Create a FlatFileReader and intialize memory. |
|
FlatFileReader(java.io.File f,
int n)
Create a FlatFileReader and intialize memory. |
|
FlatFileReader(java.lang.String s)
Create a FlatFileReader and intialize memory. |
|
FlatFileReader(java.lang.String s,
int n)
Create a FlatFileReader and intialize memory. |
|
| Method Summary | |
int |
countColumns()
Method to get the number of columns in the data array |
int |
countRows()
Method to get the number of rows in the data array |
double[] |
getColumn(int column)
Return a specific column of data. |
double[][] |
getData()
Accesor method to access the data in the flat file |
double |
getData(int row,
int column)
Accesor method to access a single data point in the flat file |
java.lang.String |
getFilename()
Accesor method to get the filename of read by the FlatFileReader |
protected void |
ID()
Method declaration |
static void |
main(java.lang.String[] args)
Method declaration |
void |
readFile()
This method does the actual reading of the data file. |
void |
setData(int row,
int column,
double n)
This method is used to replace a single value in the array of data read from a flat file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.io.File file
protected double[][] data
| Constructor Detail |
public FlatFileReader(java.lang.String s)
throws java.io.IOException
s - Name of file to read
java.io.IOException - Description of the Exception
public FlatFileReader(java.io.File f)
throws java.io.IOException
f - File object representing the file to be read
java.io.IOException - Description of the Exception
public FlatFileReader(java.lang.String s,
int n)
throws java.io.IOException
s - Name of file to readn - Number of columns of data each line should have
java.io.IOException - Description of the Exception
public FlatFileReader(java.io.File f,
int n)
throws java.io.IOException
f - File object representing the file to be readn - Number of columns of data each line should have
java.io.IOException - Description of the Exception| Method Detail |
public void readFile()
throws java.io.IOException
java.io.IOException
public void setData(int row,
int column,
double n)
row - Row of desired valuecolumn - Column of desired valuen - The value to be set at data[row][column]public double[][] getData()
public double getData(int row,
int column)
column - Column of data arrayrow - Description of the Parameter
public java.lang.String getFilename()
public double[] getColumn(int column)
column - The column of data to fetch.
public int countRows()
public int countColumns()
protected void ID()
public static void main(java.lang.String[] args)
args -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||