Parsing Engine

danbikel.parser
Class SexpObjectReader

java.lang.Object
  extended bydanbikel.parser.SexpObjectReader
All Implemented Interfaces:
ObjectReader

public class SexpObjectReader
extends Object
implements ObjectReader

Reads an underlying stream with a SexpTokenizer, reading each S-expression as a object and returning it when readObject() is invoked.


Constructor Summary
SexpObjectReader(InputStream in)
          Constructs a new instance, reading S-expressions from the specified input stream using the default character encoding.
SexpObjectReader(InputStream in, String encoding, int bufSize)
          Constructs a new object reader from the specified filename, file encoding and buffer size, by building a SexpTokenizer from the specified arguments.
SexpObjectReader(String filename, String encoding, int bufSize)
          Constructs a new object reader from the specified filename, file encoding and buffer size, by building a SexpTokenizer from the specified arguments.
 
Method Summary
 void close()
          Closes the underlying stream for this reader.
 Object readObject()
          Reads the next S-expression from the underlying S-expression reader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SexpObjectReader

public SexpObjectReader(InputStream in)
Constructs a new instance, reading S-expressions from the specified input stream using the default character encoding.

Parameters:
in - the input stream from which to read S-expressions

SexpObjectReader

public SexpObjectReader(InputStream in,
                        String encoding,
                        int bufSize)
                 throws IOException
Constructs a new object reader from the specified filename, file encoding and buffer size, by building a SexpTokenizer from the specified arguments.

Parameters:
in - the input stream from which to read S-expressions
encoding - the character encoding to use when reading from the specified file
bufSize - the buffer size to use when reading from the specified file
See Also:
SexpTokenizer.SexpTokenizer(InputStream,String,int)

SexpObjectReader

public SexpObjectReader(String filename,
                        String encoding,
                        int bufSize)
                 throws IOException
Constructs a new object reader from the specified filename, file encoding and buffer size, by building a SexpTokenizer from the specified arguments.

Parameters:
filename - the filename from which to read S-expressions
encoding - the character encoding to use when reading from the specified file
bufSize - the buffer size to use when reading from the specified file
See Also:
SexpTokenizer.SexpTokenizer(String,String,int)
Method Detail

readObject

public Object readObject()
                  throws IOException
Reads the next S-expression from the underlying S-expression reader.

Specified by:
readObject in interface ObjectReader
Returns:
the next S-expression from the underlying S-expression reader
Throws:
IOException

close

public void close()
           throws IOException
Closes the underlying stream for this reader.

Specified by:
close in interface ObjectReader
Throws:
IOException - if there is a problem closing the underlying stream for this reader

Parsing Engine

Author: Dan Bikel.