public class XmlStreamWriter extends Writer
XmlStreamReader
Constructor and Description |
---|
XmlStreamWriter(File file)
Constructs a new XML stream writer for the specified file
with a default encoding of UTF-8.
|
XmlStreamWriter(File file,
String defaultEncoding)
Constructs a new XML stream writer for the specified file
with the specified default encoding.
|
XmlStreamWriter(OutputStream out)
Constructs a new XML stream writer for the specified output stream
with a default encoding of UTF-8.
|
XmlStreamWriter(OutputStream out,
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.
|
String |
getDefaultEncoding()
Returns the default encoding.
|
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(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 interface AutoCloseable
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 encodingJas4pp 1.5 © Java Analysis Studio for Particle Physics