org.apache.xml.serializer
Class WriterToUTF8Buffered
Writer
org.apache.xml.serializer.WriterToUTF8Buffered
public final class WriterToUTF8Buffered
extends Writer
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.
void | close() - Close the stream, flushing it first.
|
void | directWrite(String s)
|
void | flush() - Flush the stream.
|
void | flushBuffer() - Flush the internal buffer
|
OutputStream | getOutputStream() - Get the output stream where the events will be serialized to.
|
void | write(String s) - Write a string.
|
void | write(chars[] , int start, int length) - Write a portion of an array of characters.
|
void | write(int c) - Write a single character.
|
WriterToUTF8Buffered
public WriterToUTF8Buffered(OutputStream out)
throws UnsupportedEncodingException
Create an buffered UTF-8 writer.
out
- the underlying output stream.
close
public void close()
throws java.io.IOException
Close the stream, flushing it first. Once a stream has been closed,
further write() or flush() invocations will cause an IOException to be
thrown. Closing a previously-closed stream, however, has no effect.
directWrite
public void directWrite(String s)
throws IOException
s
- A string with only ASCII characters
flush
public void flush()
throws java.io.IOException
Flush the stream. If the stream has saved any characters from the
various write() methods in a buffer, write them immediately to their
intended destination. Then, if that destination is another character or
byte stream, flush it. Thus one flush() invocation will flush all the
buffers in a chain of Writers and OutputStreams.
flushBuffer
public void flushBuffer()
throws IOException
Flush the internal buffer
getOutputStream
public OutputStream getOutputStream()
Get the output stream where the events will be serialized to.
- reference to the result stream, or null of only a writer was
set.
write
public void write(String s)
throws IOException
Write a string.
write
public void write(chars[] ,
int start,
int length)
throws java.io.IOException
Write a portion of an array of characters.
start
- Offset from which to start writing characterslength
- Number of characters to write
write
public void write(int c)
throws IOException
Write a single character. The character to be written is contained in
the 16 low-order bits of the given integer value; the 16 high-order bits
are ignored.
Subclasses that intend to support efficient single-character output
should override this method.
c
- int specifying a character to be written.
Copyright B) 2004 Apache XML Project. All Rights Reserved.