infovis.table.io
Class AbstractTableReader

java.lang.Object
  extended by infovis.io.AbstractReader
      extended by infovis.table.io.AbstractTableReader
Direct Known Subclasses:
AbstractGraphReader, AbstractTreeReader, CSVTableReader, HTMLGraphReader

public abstract class AbstractTableReader
extends AbstractReader

Abstract class for loading a table from a textual file.

Version:
$Revision: 1.6 $
Author:
Jean-Daniel Fekete

Constructor Summary
AbstractTableReader(InputStream in, String name, Table table)
          Creates a new AbstractTableReader object.
 
Method Summary
 void close()
          Closes the reader.
 StringBuffer getBuffer()
          Returns the buffer.
 BufferedReader getBufferedReader()
          Returns a BufferedReader associated with this stream, creating it if it does not exist yet.
 char getCommentChar()
          Returns the commentChar.
 String getField()
          Returns a string from the current buffer content.
 InputStream getIn()
          Returns the input InputStream.
 Table getTable()
          Returns the table.
 void ignoreLine()
          Ignores all comments line plus one.
 boolean isEof()
          Returns the eof.
 int read()
          Read a character.
 int readInt()
          Read an integer and return it.
 String readLine()
          Returns a line.
 boolean readQuoted(char quote)
          Read a field quoted with a specified quote character.
 void setBuffer(StringBuffer buffer)
          Sets the buffer.
 void setCommentChar(char commentChar)
          Sets the commentChar.
 void setEof(boolean eof)
          Sets the eof.
 void setTable(Table table)
          Sets the table.
 void skipToEol()
          Skips the rest of the line.
 
Methods inherited from class infovis.io.AbstractReader
createColumn, getEncoding, getName, guessFieldType, load, setEncoding, setIn, setName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTableReader

public AbstractTableReader(InputStream in,
                           String name,
                           Table table)
Creates a new AbstractTableReader object.

Parameters:
in - the BufferedReader
name - a name.
table - the table.
Method Detail

getBufferedReader

public BufferedReader getBufferedReader()
Returns a BufferedReader associated with this stream, creating it if it does not exist yet.

Overrides:
getBufferedReader in class AbstractReader
Returns:
a BufferedReader associated with this stream.

getIn

public InputStream getIn()
Returns the input InputStream.

Overrides:
getIn in class AbstractReader
Returns:
the input InputStream.

close

public void close()
           throws IOException
Closes the reader.

Overrides:
close in class AbstractReader
Throws:
IOException - when the underlying stream does so

read

public final int read()
               throws IOException
Read a character.

Returns:
a character.
Throws:
IOException - pass it.

skipToEol

public void skipToEol()
               throws IOException
Skips the rest of the line.

Throws:
IOException - pass the IOException

ignoreLine

public void ignoreLine()
                throws IOException
Ignores all comments line plus one.

Throws:
IOException - pass it.

readLine

public String readLine()
                throws IOException
Returns a line.

Returns:
a line.
Throws:
IOException - pass it.

readInt

public int readInt()
            throws IOException
Read an integer and return it.

Returns:
an integer.
Throws:
IOException - pass it.

readQuoted

public boolean readQuoted(char quote)
                   throws IOException
Read a field quoted with a specified quote character.

Parameters:
quote - the quote character,
Returns:
true if it ends the line.
Throws:
IOException - pass exception from BufferedReader.

getTable

public Table getTable()
Returns the table.

Returns:
DefaultTable

setTable

public void setTable(Table table)
Sets the table.

Parameters:
table - The table to set

getBuffer

public StringBuffer getBuffer()
Returns the buffer.

Returns:
StringBuffer

setBuffer

public void setBuffer(StringBuffer buffer)
Sets the buffer.

Parameters:
buffer - The buffer to set

getField

public String getField()
Returns a string from the current buffer content.

Returns:
a string from the current buffer content.

isEof

public boolean isEof()
Returns the eof.

Returns:
boolean

setEof

public void setEof(boolean eof)
Sets the eof.

Parameters:
eof - The eof to set

getCommentChar

public char getCommentChar()
Returns the commentChar.

Returns:
char

setCommentChar

public void setCommentChar(char commentChar)
Sets the commentChar.

Parameters:
commentChar - The commentChar to set


Copyright © 2005 by Jean-Daniel Fekete and INRIA, France All rights reserved.