public class XmlStreamWriter extends Writer
To build an instance, see XmlStreamWriter.Builder.
XmlStreamReader| Modifier and Type | Class and Description |
|---|---|
static class |
XmlStreamWriter.Builder
Builds a new
XmlStreamWriter instance. |
| Constructor and Description |
|---|
XmlStreamWriter(File file)
Deprecated.
|
XmlStreamWriter(File file,
String defaultEncoding)
Deprecated.
|
XmlStreamWriter(OutputStream out)
Deprecated.
|
XmlStreamWriter(OutputStream out,
String defaultEncoding)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
static XmlStreamWriter.Builder |
builder()
Constructs a new
XmlStreamWriter.Builder. |
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.
|
@Deprecated public XmlStreamWriter(File file) throws FileNotFoundException
builder(), XmlStreamWriter.Builder, and XmlStreamWriter.Builder.get()file - The file to write toFileNotFoundException - if there is an error creating or
opening the file@Deprecated public XmlStreamWriter(File file, String defaultEncoding) throws FileNotFoundException
builder(), XmlStreamWriter.Builder, and XmlStreamWriter.Builder.get()file - The file to write todefaultEncoding - The default encoding if not encoding could be detectedFileNotFoundException - if there is an error creating or
opening the file@Deprecated public XmlStreamWriter(OutputStream out)
builder(), XmlStreamWriter.Builder, and XmlStreamWriter.Builder.get()out - The output stream@Deprecated public XmlStreamWriter(OutputStream out, String defaultEncoding)
builder(), XmlStreamWriter.Builder, and XmlStreamWriter.Builder.get()out - The output streamdefaultEncoding - The default encoding if not encoding could be detectedpublic static XmlStreamWriter.Builder builder()
XmlStreamWriter.Builder.XmlStreamWriter.Builder.public void close() throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class WriterIOException - if an error occurs closing the underlying writerpublic void flush() throws IOException
flush in interface Flushableflush in class WriterIOException - if an error occurs flushing the underlying writerpublic String getDefaultEncoding()
public String getEncoding()
public void write(char[] cbuf, int off, int len) throws IOException
write in class Writercbuf - the buffer to write the characters fromoff - The start offsetlen - The number of characters to writeIOException - if an error occurs detecting the encodingCopyright © 2002–2023 The Apache Software Foundation. All rights reserved.