Package org.apache.xmlbeans.impl.common
Class XmlEncodingSniffer
java.lang.Object
org.apache.xmlbeans.impl.common.XmlEncodingSniffer
public class XmlEncodingSniffer extends Object
-
Constructor Summary
Constructors Constructor Description XmlEncodingSniffer(InputStream stream, String encodingOverride)Sniffs the given XML stream for encoding information.XmlEncodingSniffer(Reader reader, String encodingDefault)Sniffs the given XML stream for encoding information. -
Method Summary
Modifier and Type Method Description StringgetJavaEncoding()ReadergetReader()InputStreamgetStream()StringgetXmlEncoding()
-
Constructor Details
-
XmlEncodingSniffer
public XmlEncodingSniffer(InputStream stream, String encodingOverride) throws IOException, UnsupportedEncodingExceptionSniffs 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 sniffencodingOverride- The XML (IANA) name for the overriding encoding- Throws:
IOExceptionUnsupportedEncodingException
-
XmlEncodingSniffer
public XmlEncodingSniffer(Reader reader, String encodingDefault) throws IOException, UnsupportedEncodingExceptionSniffs 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 sniffencodingDefault- The Java name for the default encoding to apply, UTF-8 if null.- Throws:
IOExceptionUnsupportedEncodingException
-
-
Method Details