org.apache.xmlbeans.impl.common
Class XmlEncodingSniffer

java.lang.Object
  extended by org.apache.xmlbeans.impl.common.XmlEncodingSniffer

public class XmlEncodingSniffer
extends java.lang.Object


Constructor Summary
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.
 
Method Summary
 java.lang.String getJavaEncoding()
           
 java.io.Reader getReader()
           
 java.io.InputStream getStream()
           
 java.lang.String getXmlEncoding()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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