BEA Systems, Inc.


weblogic.apache.xalan.serialize
Class WriterToUTF8Buffered

java.lang.Object
  |
  +--java.io.Writer
        |
        +--weblogic.apache.xalan.serialize.WriterToUTF8Buffered

public final class WriterToUTF8Buffered
extends java.io.Writer

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.

This class is based on an implementation from the Apache XML Project. In future releases the XML parser, XSLT processor, and associated classes will likely be updated to be based on a later version of the Apache implementations. Since Apache does not guarantee backwards compatibility between versions of their software, we cannot guarantee backwards compatibility of any of the classes contained in the weblogic.apache package or sub-packages.


Fields inherited from class java.io.Writer
lock
 
Constructor Summary
WriterToUTF8Buffered(java.io.OutputStream out)
          Create an buffered UTF-8 writer.
WriterToUTF8Buffered(java.io.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
 java.io.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(java.lang.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
 

Constructor Detail

WriterToUTF8Buffered

public WriterToUTF8Buffered(java.io.OutputStream out)
                     throws java.io.UnsupportedEncodingException
Create an buffered UTF-8 writer.

Parameters:
out - the underlying output stream.
Throws:
java.io.UnsupportedEncodingException -  

WriterToUTF8Buffered

public WriterToUTF8Buffered(java.io.OutputStream out,
                            int size)
Create an buffered UTF-8 writer to write data to the specified underlying output stream with the specified buffer size.

Parameters:
out - the underlying output stream.
size - the buffer size.
Throws:
java.lang.IllegalArgumentException - if size <= 0.
Method Detail

write

public void write(int c)
           throws java.io.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.

Parameters:
c - int specifying a character to be written.
Throws:
java.io.IOException - If an I/O error occurs
Overrides:
write in class java.io.Writer

write

public void write(char[] chars,
                  int start,
                  int length)
           throws java.io.IOException
Write a portion of an array of characters.

Parameters:
chars - Array of characters
start - Offset from which to start writing characters
length - Number of characters to write
Throws:
java.io.IOException - If an I/O error occurs
java.io.IOException -  
Overrides:
write in class java.io.Writer

write

public void write(java.lang.String s)
           throws java.io.IOException
Write a string.

Parameters:
s - String to be written
Throws:
java.io.IOException - If an I/O error occurs
Overrides:
write in class java.io.Writer

flushBuffer

public void flushBuffer()
                 throws java.io.IOException
Flush the internal buffer

Throws:
java.io.IOException -  

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.

Throws:
java.io.IOException - If an I/O error occurs
java.io.IOException -  
Overrides:
flush in class java.io.Writer

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.

Throws:
java.io.IOException - If an I/O error occurs
java.io.IOException -  
Overrides:
close in class java.io.Writer

getOutputStream

public java.io.OutputStream getOutputStream()
Get the output stream where the events will be serialized to.

Returns:
reference to the result stream, or null of only a writer was set.

Documentation is available at
http://download.oracle.com/docs/cd/E13222_01/wls/docs70

Copyright © 2004 BEA Systems, Inc. All Rights Reserved.
WebLogic Server 7.0 API Reference