public class XmlStreamWriter
extends java.io.Writer
XmlStreamReader
Constructor and Description |
---|
XmlStreamWriter(java.io.File file)
Constructs a new XML stream writer for the specified file
with a default encoding of UTF-8.
|
XmlStreamWriter(java.io.File file,
java.lang.String defaultEncoding)
Constructs a new XML stream writer for the specified file
with the specified default encoding.
|
XmlStreamWriter(java.io.OutputStream out)
Constructs a new XML stream writer for the specified output stream
with a default encoding of UTF-8.
|
XmlStreamWriter(java.io.OutputStream out,
java.lang.String defaultEncoding)
Constructs a new XML stream writer for the specified output stream
with the specified default encoding.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying writer.
|
void |
flush()
Flushes the underlying writer.
|
java.lang.String |
getDefaultEncoding()
Returns the default encoding.
|
java.lang.String |
getEncoding()
Returns the detected encoding.
|
void |
write(char[] cbuf,
int off,
int len)
Writes the characters to the underlying writer, detecting encoding.
|
public XmlStreamWriter(java.io.OutputStream out)
out
- The output streampublic XmlStreamWriter(java.io.OutputStream out, java.lang.String defaultEncoding)
out
- The output streamdefaultEncoding
- The default encoding if not encoding could be detectedpublic XmlStreamWriter(java.io.File file) throws java.io.FileNotFoundException
file
- The file to write tojava.io.FileNotFoundException
- if there is an error creating or
opening the filepublic XmlStreamWriter(java.io.File file, java.lang.String defaultEncoding) throws java.io.FileNotFoundException
file
- The file to write todefaultEncoding
- The default encoding if not encoding could be detectedjava.io.FileNotFoundException
- if there is an error creating or
opening the filepublic java.lang.String getEncoding()
public java.lang.String getDefaultEncoding()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.Writer
java.io.IOException
- if an error occurs closing the underlying writerpublic void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.Writer
java.io.IOException
- if an error occurs flushing the underlying writerpublic void write(char[] cbuf, int off, int len) throws java.io.IOException
write
in class java.io.Writer
cbuf
- the buffer to write the characters fromoff
- The start offsetlen
- The number of characters to writejava.io.IOException
- if an error occurs detecting the encodingCopyright © 2010 - 2020 Adobe. All Rights Reserved