Class XmlEncodingSniffer


  • public class XmlEncodingSniffer
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      XmlEncodingSniffer​(java.io.InputStream stream, java.lang.String encodingOverride)
      Sniffs the given XML stream for encoding information.
      XmlEncodingSniffer​(java.io.Reader reader, java.lang.String encodingDefault)
      Sniffs the given XML stream for encoding information.
    • Constructor Detail

      • XmlEncodingSniffer

        public XmlEncodingSniffer​(java.io.InputStream stream,
                                  java.lang.String encodingOverride)
                           throws java.io.IOException,
                                  java.io.UnsupportedEncodingException
        Sniffs the given XML stream for encoding information. After a sniffer is constructed, it can return either a stream (which is a buffered stream wrapper of the original) or a reader (which applies the proper encoding).
        Parameters:
        stream - The stream to sniff
        encodingOverride - The XML (IANA) name for the overriding encoding
        Throws:
        java.io.IOException
        java.io.UnsupportedEncodingException
      • XmlEncodingSniffer

        public XmlEncodingSniffer​(java.io.Reader reader,
                                  java.lang.String encodingDefault)
                           throws java.io.IOException,
                                  java.io.UnsupportedEncodingException
        Sniffs the given XML stream for encoding information. After a sniffer is constructed, it can return either a reader (which is a buffered stream wrapper of the original) or a stream (which applies the proper encoding).
        Parameters:
        reader - The reader to sniff
        encodingDefault - The Java name for the default encoding to apply, UTF-8 if null.
        Throws:
        java.io.IOException
        java.io.UnsupportedEncodingException
    • Method Detail

      • getXmlEncoding

        public java.lang.String getXmlEncoding()
      • getJavaEncoding

        public java.lang.String getJavaEncoding()
      • getStream

        public java.io.InputStream getStream()
                                      throws java.io.UnsupportedEncodingException
        Throws:
        java.io.UnsupportedEncodingException
      • getReader

        public java.io.Reader getReader()
                                 throws java.io.UnsupportedEncodingException
        Throws:
        java.io.UnsupportedEncodingException