com.sun.syndication.io

Class XmlReaderException

public class XmlReaderException extends IOException

The XmlReaderException is thrown by the XmlReader constructors if the charset encoding can not be determined according to the XML 1.0 specification and RFC 3023.

The exception returns the unconsumed InputStream to allow the application to do an alternate processing with the stream. Note that the original InputStream given to the XmlReader cannot be used as that one has been already read.

Author: Alejandro Abdelnur

Field Summary
String_bomEncoding
String_contentTypeEncoding
String_contentTypeMime
InputStream_is
String_xmlEncoding
String_xmlGuessEncoding
Constructor Summary
XmlReaderException(String msg, String bomEnc, String xmlGuessEnc, String xmlEnc, InputStream is)
Creates an exception instance if the charset encoding could not be determined.
XmlReaderException(String msg, String ctMime, String ctEnc, String bomEnc, String xmlGuessEnc, String xmlEnc, InputStream is)
Creates an exception instance if the charset encoding could not be determined.
Method Summary
StringgetBomEncoding()
Returns the BOM encoding found in the InputStream.
StringgetContentTypeEncoding()
Returns the encoding in the content-type used to attempt determining the encoding.
StringgetContentTypeMime()
Returns the MIME type in the content-type used to attempt determining the encoding.
InputStreamgetInputStream()
Returns the unconsumed InputStream to allow the application to do an alternate encoding detection on the InputStream.
StringgetXmlEncoding()
Returns the encoding found in the XML prolog of the InputStream.
StringgetXmlGuessEncoding()
Returns the encoding guess based on the first bytes of the InputStream.

Field Detail

_bomEncoding

private String _bomEncoding

_contentTypeEncoding

private String _contentTypeEncoding

_contentTypeMime

private String _contentTypeMime

_is

private InputStream _is

_xmlEncoding

private String _xmlEncoding

_xmlGuessEncoding

private String _xmlGuessEncoding

Constructor Detail

XmlReaderException

public XmlReaderException(String msg, String bomEnc, String xmlGuessEnc, String xmlEnc, InputStream is)
Creates an exception instance if the charset encoding could not be determined.

Instances of this exception are thrown by the XmlReader.

Parameters: msg message describing the reason for the exception. bomEnc BOM encoding. xmlGuessEnc XML guess encoding. xmlEnc XML prolog encoding. is the unconsumed InputStream.

XmlReaderException

public XmlReaderException(String msg, String ctMime, String ctEnc, String bomEnc, String xmlGuessEnc, String xmlEnc, InputStream is)
Creates an exception instance if the charset encoding could not be determined.

Instances of this exception are thrown by the XmlReader.

Parameters: msg message describing the reason for the exception. ctMime MIME type in the content-type. ctEnc encoding in the content-type. bomEnc BOM encoding. xmlGuessEnc XML guess encoding. xmlEnc XML prolog encoding. is the unconsumed InputStream.

Method Detail

getBomEncoding

public String getBomEncoding()
Returns the BOM encoding found in the InputStream.

Returns: the BOM encoding, null if none.

getContentTypeEncoding

public String getContentTypeEncoding()
Returns the encoding in the content-type used to attempt determining the encoding.

Returns: the encoding in the content-type, null if there was not content-type, no encoding in it or the encoding detection did not involve HTTP.

getContentTypeMime

public String getContentTypeMime()
Returns the MIME type in the content-type used to attempt determining the encoding.

Returns: the MIME type in the content-type, null if there was not content-type or the encoding detection did not involve HTTP.

getInputStream

public InputStream getInputStream()
Returns the unconsumed InputStream to allow the application to do an alternate encoding detection on the InputStream.

Returns: the unconsumed InputStream.

getXmlEncoding

public String getXmlEncoding()
Returns the encoding found in the XML prolog of the InputStream.

Returns: the encoding of the XML prolog, null if none.

getXmlGuessEncoding

public String getXmlGuessEncoding()
Returns the encoding guess based on the first bytes of the InputStream.

Returns: the encoding guess, null if it couldn't be guessed.

Copyright © Sun Microsystems. All Rights Reserved.