com.tagtraum.sixbs
Class SIXBSReader

java.lang.Object
  |
  +--com.tagtraum.sixbs.SIXBSReader

public class SIXBSReader
extends Object

DeSerializes beans from XML. Objects are read asynchronously therefore excellent performance is ensured. How many objects are read ahead, can be specified - you should do this, if you are intending to read many, or very large objects. Also, if speed is very important to you, you should buffer the InputStream or Reader (if this is not done by your SAX2 parser) and set readAhead to a high value.

Version:
$Id: SIXBSReader.java,v 1.5 2001/08/06 16:46:42 Hendrik Exp $
Author:
Hendrik Schreiber
See Also:
SIXBSWriter

Field Summary
static String DEFAULTVERSION
           
static String vcid
          Source-Version
 
Constructor Summary
SIXBSReader(InputStream in)
           
SIXBSReader(InputStream in, String defaultVersion)
          Deserializes from an XML document using the given sixbs version if no version is specified in the document itself.
SIXBSReader(Reader in)
           
SIXBSReader(Reader in, String defaultVersion)
          Deserializes from an XML document using the given sixbs version if no version is specified in the document itself.
 
Method Summary
 void close()
          Closes this reader.
protected  void finalize()
           
 String getDefaultVersion()
          Returns the default sixbs version that should be used for parsing.
 int getReadAhead()
          Returns the number of Objects that are read in advance.
 boolean getValidating()
          Indicates whether validating is turned on.
 String getVersion()
          Returns the actually used version.
 boolean hasNext()
          Indicates whether we can read another object.
 Object readObject()
          Starts the reading of objects.
 void setReadAhead(int readAhead)
          Sets the number of Objects which are read in advance.
 void setValidating(boolean validating)
          Turns on validating.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vcid

public static String vcid
Source-Version


DEFAULTVERSION

public static String DEFAULTVERSION
Constructor Detail

SIXBSReader

public SIXBSReader(Reader in)
            throws IOException

SIXBSReader

public SIXBSReader(InputStream in)
            throws IOException

SIXBSReader

public SIXBSReader(Reader in,
                   String defaultVersion)
            throws IOException
Deserializes from an XML document using the given sixbs version if no version is specified in the document itself.


SIXBSReader

public SIXBSReader(InputStream in,
                   String defaultVersion)
            throws IOException
Deserializes from an XML document using the given sixbs version if no version is specified in the document itself.

Method Detail

getValidating

public boolean getValidating()
Indicates whether validating is turned on.

See Also:
setValidating(boolean)

setValidating

public void setValidating(boolean validating)
Turns on validating. This makes only sense, if you wrote a valid xml document before, i.e. you didn't use the append option in SIXBSWriter.

See Also:
getValidating()

getDefaultVersion

public String getDefaultVersion()
Returns the default sixbs version that should be used for parsing.


getVersion

public String getVersion()
Returns the actually used version. May return null if the version has not been parsed/set yet.


setReadAhead

public void setReadAhead(int readAhead)
Sets the number of Objects which are read in advance. If you have very big objects you want to keep this low, in order to keep memory consumption low. If speed is more important, set this to a high value. The default value is 10.

See Also:
getReadAhead()

getReadAhead

public int getReadAhead()
Returns the number of Objects that are read in advance.

See Also:
setReadAhead(int)

readObject

public Object readObject()
                  throws IOException
Starts the reading of objects. Note that internally more than a single object is read. Therefore exceptions which might occur, do not have to stem from the object you are currently trying to read, but may be from an object that is read in advance.

Throws:
EOFException - if the end of file is reached.
IOException
See Also:
setReadAhead(int)

hasNext

public boolean hasNext()
Indicates whether we can read another object.

Returns:
true, if another object can be read.

close

public void close()
Closes this reader. It is essential that you close the reader after you used it.


finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throwable


Copyright © 2001 tagtraum industries.