|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.Writer
org.apache.commons.io.output.XmlStreamWriter
public class XmlStreamWriter
Character stream that handles all the necessary Voodo to figure out the charset encoding of the XML document written to the stream.
XmlStreamReader| Field Summary | |
|---|---|
private static int |
BUFFER_SIZE
|
private java.lang.String |
defaultEncoding
|
private java.lang.String |
encoding
|
(package private) static java.util.regex.Pattern |
ENCODING_PATTERN
|
private java.io.OutputStream |
out
|
private java.io.Writer |
writer
|
private java.io.StringWriter |
xmlPrologWriter
|
| Fields inherited from class java.io.Writer |
|---|
lock |
| Constructor Summary | |
|---|---|
XmlStreamWriter(java.io.File file)
Construct an new XML stream writer for the specified file with a default encoding of UTF-8. |
|
XmlStreamWriter(java.io.File file,
java.lang.String defaultEncoding)
Construct an new XML stream writer for the specified file with the specified default encoding. |
|
XmlStreamWriter(java.io.OutputStream out)
Construct an 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)
Construct an new XML stream writer for the specified output stream with the specified default encoding. |
|
| Method Summary | |
|---|---|
void |
close()
Close the underlying writer. |
private void |
detectEncoding(char[] cbuf,
int off,
int len)
Detect the encoding. |
void |
flush()
Flush the underlying writer. |
java.lang.String |
getDefaultEncoding()
Return the default encoding. |
java.lang.String |
getEncoding()
Return the detected encoding. |
void |
write(char[] cbuf,
int off,
int len)
Write the characters to the underlying writer, detecing encoding. |
| Methods inherited from class java.io.Writer |
|---|
append, append, append, write, write, write, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final int BUFFER_SIZE
private final java.io.OutputStream out
private final java.lang.String defaultEncoding
private java.io.StringWriter xmlPrologWriter
private java.io.Writer writer
private java.lang.String encoding
static final java.util.regex.Pattern ENCODING_PATTERN
| Constructor Detail |
|---|
public XmlStreamWriter(java.io.OutputStream out)
out - The output stream
public XmlStreamWriter(java.io.OutputStream out,
java.lang.String defaultEncoding)
out - The output streamdefaultEncoding - The default encoding if not encoding could be detected
public XmlStreamWriter(java.io.File file)
throws java.io.FileNotFoundException
file - The file to write to
java.io.FileNotFoundException - if there is an error creating or
opening the file
public 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 detected
java.io.FileNotFoundException - if there is an error creating or
opening the file| Method Detail |
|---|
public java.lang.String getEncoding()
public java.lang.String getDefaultEncoding()
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.Writerjava.io.IOException - if an error occurs closing the underlying writer
public void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.Writerjava.io.IOException - if an error occurs flushing the underlying writer
private void detectEncoding(char[] cbuf,
int off,
int len)
throws java.io.IOException
cbuf - the buffer to write the characters fromoff - The start offsetlen - The number of characters to write
java.io.IOException - if an error occurs detecting the encoding
public void write(char[] cbuf,
int off,
int len)
throws java.io.IOException
write in class java.io.Writercbuf - the buffer to write the characters fromoff - The start offsetlen - The number of characters to write
java.io.IOException - if an error occurs detecting the encoding
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||