Package org.apache.xmlbeans.impl.common
Class XmlEncodingSniffer
- java.lang.Object
-
- org.apache.xmlbeans.impl.common.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getJavaEncoding()
java.io.Reader
getReader()
java.io.InputStream
getStream()
java.lang.String
getXmlEncoding()
-
-
-
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 sniffencodingOverride
- 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 sniffencodingDefault
- 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
-
-