org.apache.batik.ext.awt.image.spi
Interface StreamRegistryEntry

All Superinterfaces:
RegistryEntry
All Known Implementing Classes:
AbstractImageIORegistryEntry, ImageIOJPEGRegistryEntry, ImageIOPNGRegistryEntry, ImageIOTIFFRegistryEntry, JPEGRegistryEntry, MagicNumberRegistryEntry, PNGRegistryEntry, TIFFRegistryEntry

public interface StreamRegistryEntry
extends RegistryEntry

This type of Image tag registy entry is used for most normal image file formats. You are given a markable stream and an opportunity to check if it is "compatible" if you return true then you will likely be asked to provide the decoded image next.

See Also:
MagicNumberRegistryEntry

Method Summary
 int getReadlimit()
          returns the number of bytes that need to be supported by mark on the InputStream for this to check the stream for compatibility.
 Filter handleStream(InputStream is, ParsedURL origURL, boolean needRawData)
          Decode the Stream into a Filter.
 boolean isCompatibleStream(InputStream is)
          Check if the Stream references an image that can be handled by this format handler.
 
Methods inherited from interface org.apache.batik.ext.awt.image.spi.RegistryEntry
getFormatName, getMimeTypes, getPriority, getStandardExtensions
 

Method Detail

getReadlimit

int getReadlimit()
returns the number of bytes that need to be supported by mark on the InputStream for this to check the stream for compatibility.


isCompatibleStream

boolean isCompatibleStream(InputStream is)
                           throws StreamCorruptedException
Check if the Stream references an image that can be handled by this format handler. The input stream passed in should be assumed to support mark and reset. If this method throws a StreamCorruptedException then the InputStream will be closed and a new one opened (if possible). This method should only throw a StreamCorruptedException if it is unable to restore the state of the InputStream (i.e. mark/reset fails basically).

Throws:
StreamCorruptedException

handleStream

Filter handleStream(InputStream is,
                    ParsedURL origURL,
                    boolean needRawData)
Decode the Stream into a Filter. If the stream turns out not to be of a format this RegistryEntry can handle you should attempt to reset the stream, then return null.

This should only return a broken link image when the image is clearly of this format, but is unreadable for some reason.

Parameters:
is - The input stream that contains the image.
origURL - The original URL, if any, for documentation purposes only. This may be null.
needRawData - If true the image returned should not have any default color correction the file may specify applied.


Copyright © 2008 Apache Software Foundation. All Rights Reserved.