com.day.cq.dam.commons.handler
Class XMPProcessor

java.lang.Object
  extended by com.day.cq.dam.commons.handler.XMPProcessor
All Implemented Interfaces:
Processor, FilterStateListener

public class XMPProcessor
extends Object
implements Processor, FilterStateListener

Process bytes, extract metadata found in <xpacket> tags and add them to a Context.

Author:
dpfister

Constructor Summary
XMPProcessor(Context context)
          Create a new instance of this class.
 
Method Summary
 void ended(Filter filter, OutputStream out)
          Invoked when the filter detects the end of a section.
 void process(byte[] buf, int off, int len)
          Process a couple of bytes.
static InputStream process(InputStream in)
          Utility method that processes an input stream and returns the first valid XMP input stream.
 OutputStream started(Filter filter)
          Invoked when the filter detects the start of a section it understands.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMPProcessor

public XMPProcessor(Context context)
Create a new instance of this class.

Parameters:
context - context
Method Detail

process

public final void process(byte[] buf,
                          int off,
                          int len)
                   throws IOException
Process a couple of bytes.

Specified by:
process in interface Processor
Parameters:
buf - buffer
off - offset inside buffer
len - number of bytes
Throws:
IOException

started

public OutputStream started(Filter filter)
Invoked when the filter detects the start of a section it understands.

Specified by:
started in interface FilterStateListener
Parameters:
filter - filter
Returns:
output stream, if the listener wants to have the consecutive bytes automatically written to some location or null

ended

public void ended(Filter filter,
                  OutputStream out)
Invoked when the filter detects the end of a section.

Specified by:
ended in interface FilterStateListener
Parameters:
filter - filter
out - output stream returned from FilterStateListener.started(Filter) or null

process

public static InputStream process(InputStream in)
                           throws IOException,
                                  ProcessorException
Utility method that processes an input stream and returns the first valid XMP input stream.

Parameters:
in - input stream
Throws:
IOException - if an I/O error occurs
ProcessorException - if a processor error occurs


Copyright © 2011-2013 Adobe Systems Incorporated. All Rights Reserved.