Package org.apache.commons.io.input

# Class XmlStreamReaderException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
org.apache.commons.io.input.XmlStreamReaderException

All Implemented Interfaces:
  `Serializable`

public class XmlStreamReaderException extends IOException
The XmlStreamReaderException is thrown by the XmlStreamReader constructors if the charset encoding cannot 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 XmlStreamReader cannot be used as that one has been already read.

Since:
  2.0
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `XmlStreamReaderException(String msg, String bomEnc, String xmlGuessEnc, String xmlEnc)`
  Constructs an exception instance if the Charset encoding could not be determined.
  `XmlStreamReaderException(String msg, String ctMime, String ctEnc, String bomEnc, String xmlGuessEnc, String xmlEnc)`
  Constructs an exception instance if the Charset encoding could not be determined.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getBomEncoding()`
  Gets the BOM encoding found in the InputStream.
  `String`
  `getContentTypeEncoding()`
  Gets the encoding in the content-type used to attempt determining the encoding.
  `String`
  `getContentTypeMime()`
  Gets the MIME type in the content-type used to attempt determining the encoding.
  `String`
  `getXmlEncoding()`
  Gets the encoding found in the XML prolog of the input.
  `String`
  `getXmlGuessEncoding()`
  Gets the encoding guess based on the first bytes of the input.

  ### Methods inherited from class java.lang.Throwable

  `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### XmlStreamReaderException

    public XmlStreamReaderException(String msg, String bomEnc, String xmlGuessEnc, String xmlEnc)
    Constructs an exception instance if the Charset encoding could not be determined.

    Instances of this exception are thrown by the XmlStreamReader.

    Parameters:
      `msg` - message describing the reason for the exception.
      `bomEnc` - BOM encoding.
      `xmlGuessEnc` - XML guess encoding.
      `xmlEnc` - XML prolog encoding.

  - ### XmlStreamReaderException

    public XmlStreamReaderException(String msg, String ctMime, String ctEnc, String bomEnc, String xmlGuessEnc, String xmlEnc)
    Constructs an exception instance if the Charset encoding could not be determined.

    Instances of this exception are thrown by the XmlStreamReader.

    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.

- ## Method Details

  - ### getBomEncoding

    public String getBomEncoding()
    Gets the BOM encoding found in the InputStream.
    Returns:
      the BOM encoding, null if none.

  - ### getContentTypeEncoding

    public String getContentTypeEncoding()
    Gets 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()
    Gets 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.

  - ### getXmlEncoding

    public String getXmlEncoding()
    Gets the encoding found in the XML prolog of the input.
    Returns:
      the encoding of the XML prolog, null if none.

  - ### getXmlGuessEncoding

    public String getXmlGuessEncoding()
    Gets the encoding guess based on the first bytes of the input.
    Returns:
      the encoding guess, null if it couldn't be guessed.