prefuse.data.io
Class FixedWidthTextTableReader

java.lang.Object
  extended by prefuse.data.io.AbstractTableReader
      extended by prefuse.data.io.AbstractTextTableReader
          extended by prefuse.data.io.FixedWidthTextTableReader
All Implemented Interfaces:
TableReader

public class FixedWidthTextTableReader
extends AbstractTextTableReader

TableReader for fixed-width text files, that encode one row of table data per line use a fixed number of characters for each data column. Reading such tables requires use of a schema description that describes the fixed-widths for each individual column. The FixedWidthTextTableSchema class provides this functionality.

Author:
jeffrey heer

Constructor Summary
FixedWidthTextTableReader(FixedWidthTextTableSchema schema)
          Creates a new FixedWidthTextTableReader using the given schema.
FixedWidthTextTableReader(java.lang.String location)
          Creates a new FixedWidthTextTableReader using the schema at the given location.
 
Method Summary
protected  java.util.ArrayList getColumnNames()
          Subclasses can override this to provide column names through a custom mechanism.
 FixedWidthTextTableSchema getFixedWidthSchema()
          Get the schema description describing the data columns' fixed widths
protected  void read(java.io.InputStream is, TableReadListener trl)
          Scans the input stream, making call backs for each encountered entry on the provided TextReadListener.
 void setFixedWidthSchema(FixedWidthTextTableSchema schema)
          Set the schema description describing the data columns' fixed widths
 
Methods inherited from class prefuse.data.io.AbstractTextTableReader
getDefaultHeader, readTable, setHasHeader
 
Methods inherited from class prefuse.data.io.AbstractTableReader
readTable, readTable, readTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedWidthTextTableReader

public FixedWidthTextTableReader(FixedWidthTextTableSchema schema)
Creates a new FixedWidthTextTableReader using the given schema.

Parameters:
schema - the schema description of the fixed-width text column lengths

FixedWidthTextTableReader

public FixedWidthTextTableReader(java.lang.String location)
                          throws DataIOException
Creates a new FixedWidthTextTableReader using the schema at the given location.

Parameters:
location - a location string (filename, URL, or resource locator) for the schema description of the fixed-width text column lengths
Throws:
DataIOException - if an IO exception occurs while loading the schema
Method Detail

getFixedWidthSchema

public FixedWidthTextTableSchema getFixedWidthSchema()
Get the schema description describing the data columns' fixed widths

Returns:
the fixed-width table schema description

setFixedWidthSchema

public void setFixedWidthSchema(FixedWidthTextTableSchema schema)
Set the schema description describing the data columns' fixed widths

Parameters:
schema - the fixed-width table schema description

read

protected void read(java.io.InputStream is,
                    TableReadListener trl)
             throws java.io.IOException,
                    DataParseException
Description copied from class: AbstractTextTableReader
Scans the input stream, making call backs for each encountered entry on the provided TextReadListener.

Specified by:
read in class AbstractTextTableReader
Parameters:
is - the InputStream to read
trl - the TextReadListener that will receive callbacks
Throws:
java.io.IOException
DataParseException
See Also:
AbstractTextTableReader.read(java.io.InputStream, prefuse.data.io.TableReadListener)

getColumnNames

protected java.util.ArrayList getColumnNames()
Description copied from class: AbstractTextTableReader
Subclasses can override this to provide column names through a custom mechanism.

Overrides:
getColumnNames in class AbstractTextTableReader
Returns:
an ArrayList of String instances indicating the column names
See Also:
AbstractTextTableReader.getColumnNames()


Copyright © 2007 Regents of the University of California