Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.io
Class CSVFile

    java.lang.Object
      com.bbn.openmap.io.CSVFile

Direct Known Subclasses:
  CSVShapeInfoFile

public class CSVFile
extends java.lang.Object

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` | `headerRecord` The header record, if there is one
`protected boolean` | `headersExist` Whether file has a line of column headers.
`protected java.util.Vector` | `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
`java.util.Vector` | `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` | `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

### infoUrl

    public java.net.URL infoUrl

  The location of the CSV file

### infoRecords

    protected java.util.Vector infoRecords

  The records of the CSV file

### headerRecord

    protected java.util.Vector headerRecord

  The header record, if there is one

### headersExist

    protected boolean headersExist

  Whether file has a line of column headers.

Constructor Detail

### CSVFile

    public CSVFile(java.lang.String name)
            throws java.net.MalformedURLException

  Don't do anything special, since all defaults are set already

### CSVFile

    public CSVFile(java.net.URL url)
            throws java.net.MalformedURLException

  Don't do anything special, since all defaults are set already

Method Detail

### setHeadersExist

    public void setHeadersExist(boolean set)

  Set whether the first line should be considered as headers to each column.

### isHeadersExist

    public boolean isHeadersExist()

  Get whether the first line should be considered as headers to each column.

### loadData

    public void loadData()

  Reads the numbers and stores them as Doubles.

### loadData

    public void loadData(boolean readNumbersAsStrings)

  Read the data in from the file, with the option of reading the numbers in the files as strings.

### getRecord

    public java.util.Vector getRecord(int recordnumber)

  Return a particular Vector representing the contents of a record line in the CSV file. The record choice is picked via the record number given -zero is the first one, and the header record, if it exists, does not count.

  Parameters:
    `recordnumber` - the number of the record in the csv file.
  Returns:
    Vector Vector of contents of record line.

### iterator

    public java.util.Iterator iterator()

  Return an iterator, that can be used to traverse the records of the file.

  Returns:
    Iterator

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details