org.apache.commons.io.output
public class XmlStreamWriter extends Writer
XmlStreamReader
Constructor and Description |
---|
XmlStreamWriter(File file)
Construct an new XML stream writer for the specified file
with a default encoding of UTF-8.
|
XmlStreamWriter(File file,
String defaultEncoding)
Construct an new XML stream writer for the specified file
with the specified default encoding.
|
XmlStreamWriter(OutputStream out)
Construct an new XML stream writer for the specified output stream
with a default encoding of UTF-8.
|
XmlStreamWriter(OutputStream out,
String defaultEncoding)
Construct an new XML stream writer for the specified output stream
with the specified default encoding.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the underlying writer.
|
void |
flush()
Flush the underlying writer.
|
String |
getDefaultEncoding()
Return the default encoding.
|
String |
getEncoding()
Return the detected encoding.
|
void |
write(char[] cbuf,
int off,
int len)
Write the characters to the underlying writer, detecing encoding.
|
public XmlStreamWriter(OutputStream out)
out
- The output streampublic XmlStreamWriter(OutputStream out, String defaultEncoding)
out
- The output streamdefaultEncoding
- The default encoding if not encoding could be detectedpublic XmlStreamWriter(File file) throws FileNotFoundException
file
- The file to write toFileNotFoundException
- if there is an error creating or
opening the filepublic XmlStreamWriter(File file, String defaultEncoding) throws FileNotFoundException
file
- The file to write todefaultEncoding
- The default encoding if not encoding could be detectedFileNotFoundException
- if there is an error creating or
opening the filepublic String getEncoding()
public String getDefaultEncoding()
public void close() throws IOException
close
in interface Closeable
close
in class Writer
IOException
- if an error occurs closing the underlying writerpublic void flush() throws IOException
flush
in interface Flushable
flush
in class Writer
IOException
- if an error occurs flushing the underlying writerpublic void write(char[] cbuf, int off, int len) throws IOException
write
in class Writer
cbuf
- the buffer to write the characters fromoff
- The start offsetlen
- The number of characters to writeIOException
- if an error occurs detecting the encodingCopyright © 2002–2014 The Apache Software Foundation. All rights reserved.