com.sun.xml.stream
Class BufferManager

java.lang.Object
  extended by com.sun.xml.stream.BufferManager
Direct Known Subclasses:
FileBufferManager, StreamBufferManager

public abstract class BufferManager
extends java.lang.Object

Author:
Neeraj Bajaj, Sun Microsystems

Field Summary
protected  boolean endOfStream
           
 
Constructor Summary
BufferManager()
           
 
Method Summary
abstract  boolean arrangeCapacity(int length)
          xxx: This should be an abstract method because in StreamBufferManager CharBuffer capacity doesn't grow
abstract  void close()
           
 boolean endOfStream()
          This file signals the end of file
static BufferManager getBufferManager(org.apache.xerces.xni.parser.XMLInputSource inputSource)
           
abstract  java.nio.CharBuffer getCharBuffer()
           
protected  java.lang.Object[] getEncodingName(byte[] b4, int count)
          Returns the IANA encoding name that is auto-detected from the bytes specified, with the endian-ness of that encoding where appropriate.
abstract  boolean getMore()
          This function returns true if some character data was loaded.
static void main(java.lang.String[] args)
           
abstract  void setEncoding(java.lang.String encoding)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

endOfStream

protected boolean endOfStream
Constructor Detail

BufferManager

public BufferManager()
Method Detail

getBufferManager

public static BufferManager getBufferManager(org.apache.xerces.xni.parser.XMLInputSource inputSource)
                                      throws java.io.IOException
Throws:
java.io.IOException

getMore

public abstract boolean getMore()
                         throws java.io.IOException
This function returns true if some character data was loaded. Data is available via getCharBuffer(). If before calling this function CharBuffer had some data (i.e. remaining() > 0) then this function first calls CharBuffer.compact() and then it is filled with more data. After calling this function CharBuffer.position() is always 'zero'.

Returns:
true if some character data was loaded. False value can be assume to be end of current entity.
Throws:
java.io.IOException
See Also:
CharBuffer.compact()

getCharBuffer

public abstract java.nio.CharBuffer getCharBuffer()

arrangeCapacity

public abstract boolean arrangeCapacity(int length)
                                 throws java.io.IOException
xxx: This should be an abstract method because in StreamBufferManager CharBuffer capacity doesn't grow

Throws:
java.io.IOException

endOfStream

public boolean endOfStream()
This file signals the end of file

Returns:
true/false signals the end of file.

close

public abstract void close()
                    throws java.io.IOException
Throws:
java.io.IOException

setEncoding

public abstract void setEncoding(java.lang.String encoding)
                          throws java.io.IOException
Throws:
java.io.IOException

getEncodingName

protected java.lang.Object[] getEncodingName(byte[] b4,
                                             int count)
Returns the IANA encoding name that is auto-detected from the bytes specified, with the endian-ness of that encoding where appropriate.

Parameters:
b4 - The first four bytes of the input.
count - The number of bytes actually read.
Returns:
a 2-element array: the first element, an IANA-encoding string, the second element a Boolean which is true iff the document is big endian, false if it's little-endian, and null if the distinction isn't relevant.

main

public static void main(java.lang.String[] args)


Copyright ? 2002-2003 Apache XML Project. All Rights Reserved.