org.apache.commons.io.output

Class XmlStreamWriter

  • All Implemented Interfaces:
    Closeable, Flushable, Appendable, AutoCloseable


    public class XmlStreamWriterextends Writer
    Character stream that handles all the necessary Voodo to figure out the charset encoding of the XML document written to the stream.
    Since:
    2.0
    Version:
    $Id: XmlStreamWriter.java 1415850 2012-11-30 20:51:39Z ggregory $
    See Also:
    XmlStreamReader
    • Constructor Detail

      • XmlStreamWriter

        public XmlStreamWriter(OutputStream out)
        Construct an new XML stream writer for the specified output stream with a default encoding of UTF-8.
        Parameters:
        out - The output stream
      • XmlStreamWriter

        public XmlStreamWriter(OutputStream out,               String defaultEncoding)
        Construct an new XML stream writer for the specified output stream with the specified default encoding.
        Parameters:
        out - The output stream
        defaultEncoding - The default encoding if not encoding could be detected
      • XmlStreamWriter

        public XmlStreamWriter(File file)                throws FileNotFoundException
        Construct an new XML stream writer for the specified file with a default encoding of UTF-8.
        Parameters:
        file - The file to write to
        Throws:
        FileNotFoundException - if there is an error creating or opening the file
      • XmlStreamWriter

        public XmlStreamWriter(File file,               String defaultEncoding)                throws FileNotFoundException
        Construct an new XML stream writer for the specified file with the specified default encoding.
        Parameters:
        file - The file to write to
        defaultEncoding - The default encoding if not encoding could be detected
        Throws:
        FileNotFoundException - if there is an error creating or opening the file
    • Method Detail

      • getEncoding

        public String getEncoding()
        Return the detected encoding.
        Returns:
        the detected encoding
      • getDefaultEncoding

        public String getDefaultEncoding()
        Return the default encoding.
        Returns:
        the default encoding
      • write

        public void write(char[] cbuf,         int off,         int len)           throws IOException
        Write the characters to the underlying writer, detecing encoding.
        Specified by:
        write in class Writer
        Parameters:
        cbuf - the buffer to write the characters from
        off - The start offset
        len - The number of characters to write
        Throws:
        IOException - if an error occurs detecting the encoding

Copyright © 2002–2016 The Apache Software Foundation. All rights reserved.



NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14