Berkeley DB XML
version 2.5.16

com.sleepycat.dbxml
Class XmlInputStream

java.lang.Object
  extended by com.sleepycat.dbxml.XmlInputStream

public class XmlInputStream
extends Object

Used to read and write XML data. You can obtain an instance of this object using one of XmlManager.createLocalFileInputStream(java.lang.String),
XmlManager.createStdInInputStream(),
XmlManager.createURLInputStream(java.lang.String, java.lang.String, java.lang.String),
XmlManager.createInputStream(java.io.InputStream), or
XmlDocument.getContentAsXmlInputStream().
You use instances of this class with XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument) and XmlDocument.setContentAsXmlInputStream(com.sleepycat.dbxml.XmlInputStream).

You can manually retrieve the contents of the input stream using readBytes(byte[], long) and curPos().

XmlInputStream is a pure virtual interface. It can be subclassed by an application, and an instance passed to any of the methods that take XmlInputStream as a parameter, such as XmlContainer.putDocument(com.sleepycat.dbxml.XmlDocument). This is especially useful for streaming XML from an application directly into Berkeley DB XML without first converting it to a string.


Constructor Summary
XmlInputStream()
           
 
Method Summary
 long curPos()
          Returns the number of bytes currently read from the beginning of the input stream.
 void delete()
          Free the native resources associated with this object.
 long readBytes(byte[] toFill, long maxToRead)
          Reads maxToRead number of bytes from the input stream and places those bytes in toFill.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlInputStream

public XmlInputStream()
Method Detail

delete

public void delete()
Free the native resources associated with this object.


curPos

public long curPos()
            throws XmlException
Returns the number of bytes currently read from the beginning of the input stream.

Throws:
XmlException

readBytes

public long readBytes(byte[] toFill,
                      long maxToRead)
               throws XmlException
Reads maxToRead number of bytes from the input stream and places those bytes in toFill. Returns the number of bytes read, or 0 if the end of the stream has been reached.

Parameters:
toFill - A buffer used to place the bytes read from the input stream. It is the responsibility of the programmer to ensure that the buffer provided here is large enough for the amount of data to be read.
maxToRead - Identifies the maximum number of bytes to read from the input stream.
Throws:
XmlException

Berkeley DB XML
version 2.5.16

Copyright (c) 1996,2009 Oracle. All rights reserved.