Interface XMLStreamReaderEx

  • All Superinterfaces:
    XMLStreamConstants, XMLStreamReader

    public interface XMLStreamReaderEx
    extends XMLStreamReader
    XMLStreamReader extended for reading binary data.

    Some producer of infoset (in particular, such as FastInfoset, XOP decoder), uses a native format that enables efficient treatment of binary data. For ordinary infoset consumer (that just uses XMLStreamReader, those binary data will just look like base64-encoded string, but this interface allows consumers of such infoset to access this raw binary data. Such infoset producer may choose to implement this additoinal interface, to expose this functionality.

    Consumers that are capable of using this interface can query XMLStreamReader if it supports this by simply downcasting it to this interface like this:

     XMLStreamReader reader = ...;
     if( reader instanceof XMLStreamReaderEx ) {
       // this reader supports binary data exchange
       ...
     } else {
       // noop
       ...
     }
     

    Also note that it is also allowed for the infoset producer to implement this interface in such a way that getPCDATA() always delegate to XMLStreamReader.getText(), although it's not desirable.

    This interface is a private contract between such producers and consumers to allow them to exchange binary data without converting it to base64.

    Author:
    Kohsuke Kawaguchi, Paul Sandoz
    See Also:
    XMLStreamWriterEx