|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Writer org.apache.xml.serializer.WriterToUTF8Buffered
final class WriterToUTF8Buffered
This class writes unicode characters to a byte stream (java.io.OutputStream) as quickly as possible. It buffers the output in an internal buffer which must be flushed to the OutputStream when done. This flushing is done via the close() flush() or flushBuffer() method. This class is only used internally within Xalan.
Field Summary | |
---|---|
private static int |
BYTES_MAX
number of bytes that the byte buffer can hold. |
private static int |
CHARS_MAX
number of characters that the character buffer can hold. |
private int |
count
The number of valid bytes in the buffer. |
private char[] |
m_inputChars
|
private java.io.OutputStream |
m_os
The byte stream to write to. |
private byte[] |
m_outputBytes
The internal buffer where data is stored. |
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
WriterToUTF8Buffered(java.io.OutputStream out)
Create an buffered UTF-8 writer. |
Method Summary | |
---|---|
void |
close()
Close the stream, flushing it first. |
void |
flush()
Flush the stream. |
void |
flushBuffer()
Flush the internal buffer |
java.io.OutputStream |
getOutputStream()
Get the output stream where the events will be serialized to. |
java.io.Writer |
getWriter()
If this method returns null, getOutputStream() must return non-null. |
void |
write(char[] chars,
int start,
int length)
Write a portion of an array of characters. |
void |
write(int c)
Write a single character. |
void |
write(java.lang.String s)
Write a string. |
Methods inherited from class java.io.Writer |
---|
append, append, append, write, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.xml.serializer.WriterChain |
---|
write, write |
Field Detail |
---|
private static final int BYTES_MAX
private static final int CHARS_MAX
private final java.io.OutputStream m_os
private final byte[] m_outputBytes
private final char[] m_inputChars
private int count
Constructor Detail |
---|
public WriterToUTF8Buffered(java.io.OutputStream out)
out
- the underlying output stream.
java.io.UnsupportedEncodingException
Method Detail |
---|
public void write(int c) throws java.io.IOException
Subclasses that intend to support efficient single-character output should override this method.
write
in interface WriterChain
write
in class java.io.Writer
c
- int specifying a character to be written.
java.io.IOException
- If an I/O error occurspublic void write(char[] chars, int start, int length) throws java.io.IOException
write
in interface WriterChain
write
in class java.io.Writer
chars
- Array of charactersstart
- Offset from which to start writing characterslength
- Number of characters to write
java.io.IOException
- If an I/O error occurs
java.io.IOException
public void write(java.lang.String s) throws java.io.IOException
write
in interface WriterChain
write
in class java.io.Writer
s
- String to be written
java.io.IOException
- If an I/O error occurspublic void flushBuffer() throws java.io.IOException
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in interface WriterChain
flush
in class java.io.Writer
java.io.IOException
- If an I/O error occurs
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface WriterChain
close
in class java.io.Writer
java.io.IOException
- If an I/O error occurs
java.io.IOException
public java.io.OutputStream getOutputStream()
getOutputStream
in interface WriterChain
public java.io.Writer getWriter()
WriterChain
getWriter
in interface WriterChain
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |