Package com.day.cq.dam.commons.handler
Class DefaultFormatHandler
- java.lang.Object
-
- com.day.cq.dam.commons.handler.DefaultFormatHandler
-
- All Implemented Interfaces:
FormatHandler
public class DefaultFormatHandler extends Object implements FormatHandler
Base class for format handlers.
-
-
Constructor Summary
Constructors Constructor Description DefaultFormatHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccepts(byte[] data, int off, int len)Return a flag indicating whether the handler is able to handle the data.InputStreamgetMetadata(InputStream in)Return metadata as in input stream (utility method).BufferedImagegetThumbnailImage(InputStream in)Return a thumbnail image from an input stream (utility method).voidprocess(InputStream in, Context context)Process the input stream given.
-
-
-
Method Detail
-
accepts
public boolean accepts(byte[] data, int off, int len)Return a flag indicating whether the handler is able to handle the data. The default format handler accepts all kind of data.- Specified by:
acceptsin interfaceFormatHandler- Parameters:
data- data bufferoff- offsetlen- number of valid bytes- Returns:
trueif the handler is able to handle the data;falseotherwise
-
process
public final void process(InputStream in, Context context) throws IOException
Process the input stream given.- Specified by:
processin interfaceFormatHandler- Parameters:
in- input streamcontext- call context- Throws:
IOException- if an I/O error occurs
-
getThumbnailImage
public BufferedImage getThumbnailImage(InputStream in) throws IOException, ProcessorException
Return a thumbnail image from an input stream (utility method).- Specified by:
getThumbnailImagein interfaceFormatHandler- Parameters:
in- input stream- Returns:
- buffered image or
null - Throws:
IOException- if an I/O error occursProcessorException- if a processor reports an error
-
getMetadata
public InputStream getMetadata(InputStream in) throws IOException, ProcessorException
Return metadata as in input stream (utility method).- Specified by:
getMetadatain interfaceFormatHandler- Parameters:
in- input stream- Returns:
- metadata input stream or
null - Throws:
IOException- if an I/O error occursProcessorException- if a processor reports an error
-
-