public boolean parse(InputStream in, OutputStream xmlOut) throws IOException {
        if (!in.markSupported()) {
            in = new java.io.BufferedInputStream(in);
        }
        boolean foundXMP = skipAfter(in, PACKET_HEADER);
        if (!foundXMP) {
            return false;
        }
        //TODO Inspect "begin" attribute!
        if (!skipAfter(in, PACKET_HEADER_END)) {
            throw new IOException("Invalid XMP packet header!");
        }
        //TODO Do with TeeInputStream when Commons IO 1.4 is available
        if (!skipAfter(in, PACKET_TRAILER, xmlOut)) {
            throw new IOException("XMP packet not properly terminated!");
        }
        return true;
    }
Locates an XMP packet in a stream, parses it and returns the XMP metadata. If no
XMP packet is found until the stream ends, null is returned. Note: This method
only finds the first XMP packet in a stream. And it cannot determine whether it
has found the right XMP packet if there are multiple packets.
<p/>
Does <em>not</em> close the stream.
If XMP block was found reading can continue below the block.

@param in     the InputStream to search
@param xmlOut to write the XMP packet to
@return true if XMP packet is found, false otherwise
@throws IOException          if an I/O error occurs
@throws TransformerException if an error occurs while parsing the XMP packet
tika-parsers/tika-parsers-standard/tika-parsers-standard-modules/tika-parser-xmp-commons/src/main/java/org/apache/tika/parser/xmp/XMPPacketScanner.java