public class DefaultFormatHandler extends java.lang.Object implements FormatHandler
| Constructor and Description |
|---|
DefaultFormatHandler() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
accepts(byte[] data,
int off,
int len)
Return a flag indicating whether the handler is able to handle the data.
|
protected Processor[] |
getAllProcessors(Context context)
Return all processors available for this mime type.
|
java.io.InputStream |
getMetadata(java.io.InputStream in)
Return metadata as in input stream (utility method).
|
protected Processor[] |
getMetadataProcessors(Context context)
Return the processors responsible for detecting metadata.
|
java.awt.image.BufferedImage |
getThumbnailImage(java.io.InputStream in)
Return a thumbnail image from an input stream (utility method).
|
protected Processor[] |
getThumbnailProcessors(Context context)
Return the processors responsible for detecting thumbnails.
|
protected int |
locate(byte[] pattern,
byte[] data,
int off,
int len)
Locate the pattern given in a byte array.
|
protected boolean |
matchPrefix(byte[] expected,
byte[] actual)
Check whether the bytes following match the given byte array.
|
void |
process(java.io.InputStream in,
Context context)
Process the input stream given.
|
public boolean accepts(byte[] data,
int off,
int len)
accepts in interface FormatHandlerdata - data bufferoff - offsetlen - number of valid bytestrue if the handler is able to handle the data; false otherwiseprotected Processor[] getThumbnailProcessors(Context context)
protected Processor[] getMetadataProcessors(Context context)
protected Processor[] getAllProcessors(Context context)
public final void process(java.io.InputStream in,
Context context)
throws java.io.IOException
process in interface FormatHandlerin - input streamcontext - call contextjava.io.IOException - if an I/O error occurspublic java.awt.image.BufferedImage getThumbnailImage(java.io.InputStream in)
throws java.io.IOException,
ProcessorException
getThumbnailImage in interface FormatHandlerin - input streamnulljava.io.IOException - if an I/O error occursProcessorException - if a processor reports an errorpublic java.io.InputStream getMetadata(java.io.InputStream in)
throws java.io.IOException,
ProcessorException
getMetadata in interface FormatHandlerin - input streamnulljava.io.IOException - if an I/O error occursProcessorException - if a processor reports an errorprotected int locate(byte[] pattern,
byte[] data,
int off,
int len)
pattern - binary pattern to locatedata - data to scanoff - offset inside datalen - number of valid bytes in data-1 if pattern was not foundprotected boolean matchPrefix(byte[] expected,
byte[] actual)
throws java.io.IOException
expected - byte arrayactual - actual bytes followingtrue if the bytes following match;
false otherwise.java.io.IOException - if an I/O error occurs