| java.lang.Object java.io.Writer com.sun.xml.stream.writers.XMLWriter
XMLWriter | public class XMLWriter extends Writer (Code) | | XMLWriter.
XMLWriter is not thread safe.
For efficiency this writer buffers the input. Use flush() function
to explicitly write the data to underlying stream.
This writer is designed in such a way that it atleast buffers the input to the
size specified. Unless flush is called, it guarantees that
data in chunks of size equal to or more than size specified will be written.
XMLWriter instance can be reused. setWriter() internally clears the
buffer and stores the reference to newly supplied Writer instance.
author: Neeraj Bajaj Sun Microsystems, inc. author: Sunitha Reddy Sun Microsystems, inc. |
Method Summary | |
public void | close() Close the stream, flushing it first. | public void | flush() Flush the stream. | protected Writer | getWriter() | public void | reset() Reset this Writer. | public void | setWriter(Writer writer) Set the given Writer . | public void | setWriter(Writer writer, int size) Set the given Writer
Parameters: Writer - Writer. | public void | write(int c) Write a single character. | public void | write(char cbuf) Write an array of characters. | public void | write(char cbuf, int off, int len) Write a portion of an array of characters. | public void | write(String str, int off, int len) Write a portion of a string. | public void | write(String str) Write a string. |
XMLWriter | public XMLWriter(Writer writer)(Code) | | Creates the instance of XMLWriter
|
XMLWriter | public XMLWriter(Writer writer, int size)(Code) | | Creates the instnace of XMLWriter .
atleast buffers the input to the
size specified.
|
close | public void close() throws IOException(Code) | | 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.
exception: IOException - If an I/O error occurs |
flush | public void flush() throws IOException(Code) | | 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.
exception: IOException - If an I/O error occurs |
getWriter | protected Writer getWriter()(Code) | | Returns underlying Writer
|
reset | public void reset()(Code) | | Reset this Writer.
see @setWriter()
|
setWriter | public void setWriter(Writer writer)(Code) | | Set the given Writer .
Parameters: Writer - Writer. |
setWriter | public void setWriter(Writer writer, int size)(Code) | | Set the given Writer
Parameters: Writer - Writer. int Writer will buffer the character data size, after that data is written to stream. |
write | public void write(int c) throws IOException(Code) | | 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. exception: IOException - If an I/O error occurs |
write | public void write(char cbuf) throws IOException(Code) | | Write an array of characters.
Parameters: cbuf - Array of characters to be written exception: IOException - If an I/O error occurs |
write | public void write(char cbuf, int off, int len) throws IOException(Code) | | Write a portion of an array of characters.
Parameters: cbuf - Array of characters Parameters: off - Offset from which to start writing characters Parameters: len - Number of characters to write exception: IOException - If an I/O error occurs |
write | public void write(String str, int off, int len) throws IOException(Code) | | Write a portion of a string.
Parameters: str - A String Parameters: off - Offset from which to start writing characters Parameters: len - Number of characters to write exception: IOException - If an I/O error occurs |
|
|