|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.Writer org.apache.xalan.serialize.WriterToUTF8Buffered
This class writes ASCII to a byte stream as quickly as possible. For the moment it does not do buffering, though I reserve the right to do some buffering down the line if I can prove that it will be faster even if the output stream is buffered.
Field Summary | |
private byte[] |
buf
The internal buffer where data is stored. |
private int |
count
The number of valid bytes in the buffer. |
private OutputStream |
m_os
The byte stream to write to. |
Fields inherited from class java.io.Writer |
lock |
Constructor Summary | |
WriterToUTF8Buffered(OutputStream out)
Create an buffered UTF-8 writer. |
|
WriterToUTF8Buffered(OutputStream out,
int size)
Create an buffered UTF-8 writer to write data to the specified underlying output stream with the specified buffer size. |
Method Summary | |
void |
close()
Close the stream, flushing it first. |
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(char[] chars,
int start,
int length)
Write a portion of an array of characters. |
void |
write(int c)
Write a single character. |
void |
write(String s)
Write a string. |
private void |
writeDirect(char[] chars,
int start,
int length)
Write a portion of an array of characters. |
private void |
writeDirect(String s)
Write a string. |
Methods inherited from class java.io.Writer |
write, write |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private OutputStream m_os
private byte[] buf
private int count
Constructor Detail |
public WriterToUTF8Buffered(OutputStream out) throws UnsupportedEncodingException
out
- the underlying output stream.
UnsupportedEncodingException
public WriterToUTF8Buffered(OutputStream out, int size)
out
- the underlying output stream.size
- the buffer size.
IllegalArgumentException
- if size <= 0.Method Detail |
public void write(int c) throws IOException
Subclasses that intend to support efficient single-character output should override this method.
write
in class Writer
c
- int specifying a character to be written.
IOException
- If an I/O error occursprivate final void writeDirect(char[] chars, int start, int length) throws IOException
chars
- Array of charactersstart
- Offset from which to start writing characterslength
- Number of characters to write
IOException
- If an I/O error occurs
IOException
private final void writeDirect(String s) throws IOException
s
- String to be written
IOException
- If an I/O error occurspublic void write(char[] chars, int start, int length) throws IOException
write
in class Writer
chars
- Array of charactersstart
- Offset from which to start writing characterslength
- Number of characters to write
IOException
- If an I/O error occurs
IOException
public void write(String s) throws IOException
write
in class Writer
s
- String to be written
IOException
- If an I/O error occurspublic void flushBuffer() throws IOException
IOException
public void flush() throws IOException
flush
in class Writer
IOException
- If an I/O error occurs
IOException
public void close() throws IOException
close
in class Writer
IOException
- If an I/O error occurs
IOException
public OutputStream getOutputStream()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |