Class DefaultFormatHandler

  • All Implemented Interfaces:
    FormatHandler

    public class DefaultFormatHandler
    extends java.lang.Object
    implements FormatHandler
    Base class for format handlers.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accepts​(byte[] data, int off, int len)
      Return a flag indicating whether the handler is able to handle the data.
      java.io.InputStream getMetadata​(java.io.InputStream in)
      Return metadata as in input stream (utility method).
      java.awt.image.BufferedImage getThumbnailImage​(java.io.InputStream in)
      Return a thumbnail image from an input stream (utility method).
      void process​(java.io.InputStream in, Context context)
      Process the input stream given.
      • Methods inherited from class java.lang.Object

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

      • DefaultFormatHandler

        public DefaultFormatHandler()
    • 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:
        accepts in interface FormatHandler
        Parameters:
        data - data buffer
        off - offset
        len - number of valid bytes
        Returns:
        true if the handler is able to handle the data; false otherwise
      • process

        public final void process​(java.io.InputStream in,
                                  Context context)
                           throws java.io.IOException
        Process the input stream given.
        Specified by:
        process in interface FormatHandler
        Parameters:
        in - input stream
        context - call context
        Throws:
        java.io.IOException - if an I/O error occurs
      • getThumbnailImage

        public java.awt.image.BufferedImage getThumbnailImage​(java.io.InputStream in)
                                                       throws java.io.IOException,
                                                              ProcessorException
        Return a thumbnail image from an input stream (utility method).
        Specified by:
        getThumbnailImage in interface FormatHandler
        Parameters:
        in - input stream
        Returns:
        buffered image or null
        Throws:
        java.io.IOException - if an I/O error occurs
        ProcessorException - if a processor reports an error
      • getMetadata

        public java.io.InputStream getMetadata​(java.io.InputStream in)
                                        throws java.io.IOException,
                                               ProcessorException
        Return metadata as in input stream (utility method).
        Specified by:
        getMetadata in interface FormatHandler
        Parameters:
        in - input stream
        Returns:
        metadata input stream or null
        Throws:
        java.io.IOException - if an I/O error occurs
        ProcessorException - if a processor reports an error