|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bbn.openmap.io.CSVFile
public class CSVFile
The CSVFile holds on to the contents of a CSV file.
NOTE: By default, the numbers that are found in the CSV file are converted to Doubles. Use the load(boolean) method to control this, especially if you are using the fields later as the key in a Hashtable.
Field Summary | |
---|---|
protected java.util.Vector<java.lang.Object> |
headerRecord
The header record, if there is one |
protected boolean |
headersExist
Whether file has a line of column headers. |
protected java.util.Vector<java.util.Vector<java.lang.Object>> |
infoRecords
The records of the CSV file |
java.net.URL |
infoUrl
The location of the CSV file |
Constructor Summary | |
---|---|
CSVFile(java.lang.String name)
Don't do anything special, since all defaults are set already |
|
CSVFile(java.net.URL url)
Don't do anything special, since all defaults are set already |
Method Summary | |
---|---|
int |
getNumberOfRecords()
|
java.util.Vector<java.lang.Object> |
getRecord(int recordnumber)
Return a particular Vector representing the contents of a record line in the CSV file. |
boolean |
isHeadersExist()
Get whether the first line should be considered as headers to each column. |
java.util.Iterator<java.util.Vector<java.lang.Object>> |
iterator()
Return an iterator, that can be used to traverse the records of the file. |
void |
loadData()
Reads the numbers and stores them as Doubles. |
void |
loadData(boolean readNumbersAsStrings)
Read the data in from the file, with the option of reading the numbers in the files as strings. |
void |
setHeadersExist(boolean set)
Set whether the first line should be considered as headers to each column. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public java.net.URL infoUrl
protected java.util.Vector<java.util.Vector<java.lang.Object>> infoRecords
protected java.util.Vector<java.lang.Object> headerRecord
protected boolean headersExist
Constructor Detail |
---|
public CSVFile(java.lang.String name) throws java.net.MalformedURLException
java.net.MalformedURLException
public CSVFile(java.net.URL url) throws java.net.MalformedURLException
java.net.MalformedURLException
Method Detail |
---|
public void setHeadersExist(boolean set)
public boolean isHeadersExist()
public void loadData()
public void loadData(boolean readNumbersAsStrings)
public int getNumberOfRecords()
public java.util.Vector<java.lang.Object> getRecord(int recordnumber)
recordnumber
- the number of the record in the csv file.
public java.util.Iterator<java.util.Vector<java.lang.Object>> iterator()
iterator
in interface java.lang.Iterable<java.util.Vector<java.lang.Object>>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |