|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object smithers.files.CSVReader
public class CSVReader
Reads data from a CSV file.
Constructor Summary | |
---|---|
CSVReader(java.io.File file)
Creates a CSVReader which reads from the specified file. |
|
CSVReader(java.lang.String fileName)
Creates a CSVReader which reads from the specified file. |
Method Summary | |
---|---|
java.lang.String |
currentRow()
Returns the current row of the table. |
java.lang.String |
getCell(int i)
Returns the specified cell of the current row of the table. |
java.lang.String |
nextRow()
Reads the next table row from the file. |
int |
numColumns()
Returns the number of columns in the current row of the table. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CSVReader(java.lang.String fileName) throws java.io.FileNotFoundException
CSVReader
which reads from the specified file.
fileName
- the name of the file to read from
java.io.FileNotFoundException
- if the file is not foundpublic CSVReader(java.io.File file) throws java.io.FileNotFoundException
CSVReader
which reads from the specified file.
file
- the file to read from
java.io.FileNotFoundException
- if the file is not foundMethod Detail |
---|
public java.lang.String currentRow()
nextRow()
, if there was no such call,
this returns null
.
String
public int numColumns()
public java.lang.String getCell(int i)
numColumns()
.
i
- the column index
java.lang.IndexOutOfBoundsException
- if i<0 || i>= numColumns()
public java.lang.String nextRow() throws java.io.IOException
currentRow()
, numColumns()
and getCell(int)
methods and returns the row as a
String
. If the end of the file has already been reached, null
is returned. If the end of the file is reached before the end of
the row (i.e. when the quotes defining a cell are unclosed), the cell
(and row) are assumed to be complete.
String
java.io.IOException
- if one occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |