Class XMPPacketScanner


  • public class XMPPacketScanner
    extends java.lang.Object
    This class is a parser for XMP packets. By default, it tries to locate the first XMP packet it finds and parses it.

    Important: Before you use this class to look for an XMP packet in some random file, please read the chapter on "Scanning Files for XMP Packets" in the XMP specification!

    Thic class was branched from http://xmlgraphics.apache.org/ XMPPacketParser. See also org.semanticdesktop.aperture.extractor.xmp.XMPExtractor, a variant.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean parse​(java.io.InputStream in, java.io.OutputStream xmlOut)
      Locates an XMP packet in a stream, parses it and returns the XMP metadata.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XMPPacketScanner

        public XMPPacketScanner()
    • Method Detail

      • parse

        public boolean parse​(java.io.InputStream in,
                             java.io.OutputStream xmlOut)
                      throws java.io.IOException
        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.

        Does not close the stream. If XMP block was found reading can continue below the block.

        Parameters:
        in - the InputStream to search
        xmlOut - to write the XMP packet to
        Returns:
        true if XMP packet is found, false otherwise
        Throws:
        java.io.IOException - if an I/O error occurs
        TransformerException - if an error occurs while parsing the XMP packet