com.sun.xml.stream
Class StreamBufferManager
java.lang.Object
com.sun.xml.stream.BufferManager
com.sun.xml.stream.StreamBufferManager
public class StreamBufferManager
- extends BufferManager
- Author:
- Neeraj Bajaj, Sun Microsystems
Constructor Summary |
StreamBufferManager(java.io.InputStream stream,
java.lang.String encoding)
Creates a new instance of StreamBufferManager |
Method Summary |
boolean |
arrangeCapacity(int length)
xxx: This should be an abstract method because in StreamBufferManager
CharBuffer capacity doesn't grow |
void |
close()
|
protected java.io.Reader |
createReader(java.io.InputStream inputStream,
java.lang.String encoding,
java.lang.Boolean isBigEndian)
Creates a reader capable of reading the given input stream in
the specified encoding. |
java.nio.CharBuffer |
getCharBuffer()
|
boolean |
getMore()
This function returns true if some character data was loaded. |
static void |
main(java.lang.String[] args)
|
void |
setEncoding(java.lang.String encoding)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StreamBufferManager
public StreamBufferManager(java.io.InputStream stream,
java.lang.String encoding)
throws java.io.IOException
- Creates a new instance of StreamBufferManager
- Throws:
java.io.IOException
getCharBuffer
public java.nio.CharBuffer getCharBuffer()
- Specified by:
getCharBuffer
in class BufferManager
getMore
public 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'.
- Specified by:
getMore
in class BufferManager
- 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()
createReader
protected java.io.Reader createReader(java.io.InputStream inputStream,
java.lang.String encoding,
java.lang.Boolean isBigEndian)
throws java.io.IOException
- Creates a reader capable of reading the given input stream in
the specified encoding.
- Parameters:
inputStream
- The input stream.encoding
- The encoding name that the input stream is
encoded using. If the user has specified that
Java encoding names are allowed, then the
encoding name may be a Java encoding name;
otherwise, it is an ianaEncoding name.isBigEndian
- For encodings (like uCS-4), whose names cannot
specify a byte order, this tells whether the order is bigEndian. null menas
unknown or not relevant.
- Returns:
- Returns a reader.
- Throws:
java.io.IOException
main
public static void main(java.lang.String[] args)
close
public void close()
throws java.io.IOException
- Specified by:
close
in class BufferManager
- Throws:
java.io.IOException
setEncoding
public void setEncoding(java.lang.String encoding)
throws java.io.IOException
- Specified by:
setEncoding
in class BufferManager
- Throws:
java.io.IOException
arrangeCapacity
public boolean arrangeCapacity(int length)
throws java.io.IOException
- Description copied from class:
BufferManager
- xxx: This should be an abstract method because in StreamBufferManager
CharBuffer capacity doesn't grow
- Specified by:
arrangeCapacity
in class BufferManager
- Throws:
java.io.IOException
Copyright ? 2002-2003 Apache XML Project. All Rights Reserved.