Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.batik.ext.awt.image.spi
Class MagicNumberRegistryEntry

    java.lang.Object
      org.apache.batik.ext.awt.image.spi.AbstractRegistryEntry
          org.apache.batik.ext.awt.image.spi.MagicNumberRegistryEntry

All Implemented Interfaces:
  ErrorConstants, RegistryEntry, StreamRegistryEntry

Direct Known Subclasses:
  AbstractImageIORegistryEntry, JPEGRegistryEntry, PNGRegistryEntry, TIFFRegistryEntry

    public abstract class MagicNumberRegistryEntry

extends AbstractRegistryEntry
implements StreamRegistryEntry

This Image tag registry entry is built around the notion of magic numbers. These are strings of bytes that are at a well known location in the input stream (often the start). This base class can handle the compatiblity check based on a list of Magic Numbers that correspond to your format (Some formats have multiple magic numbers associated with them).

Nested Class Summary
`static class` | `MagicNumberRegistryEntry.MagicNumber` Inner class that represents one magic number.

Field Summary
`static float` | `PRIORITY`

Fields inherited from interface org.apache.batik.ext.awt.image.spi.ErrorConstants
`ERR_STREAM_FORMAT_UNREADABLE, ERR_STREAM_UNREADABLE, ERR_URL_FORMAT_UNREADABLE, ERR_URL_UNINTERPRETABLE, ERR_URL_UNREACHABLE, RESOURCES`

Constructor Summary
`MagicNumberRegistryEntry(String name, float priority, String[] exts, String[] mimeTypes, int offset, byte[] magicNumber)` Constructor, simplifies construction of entry when only one magic number is required.
`MagicNumberRegistryEntry(String name, float priority, String[] exts, String[] mimeTypes, MagicNumberRegistryEntry.MagicNumber[] magicNumbers)` Constructor
`MagicNumberRegistryEntry(String name, float priority, String ext, String mimeType, int offset, byte[] magicNumber)` Constructor, simplifies construction of entry when only one extension and one magic number is required.
`MagicNumberRegistryEntry(String name, float priority, String ext, String mimeType, MagicNumberRegistryEntry.MagicNumber[] magicNumbers)` Constructor, simplifies construction of entry when only one extension is required.
`MagicNumberRegistryEntry(String name, String[] exts, String[] mimeTypes, int offset, byte[] magicNumbers)` Constructor, simplifies construction of entry when only one magic number is required.
`MagicNumberRegistryEntry(String name, String[] exts, String[] mimeTypes, MagicNumberRegistryEntry.MagicNumber[] magicNumbers)` Constructor
`MagicNumberRegistryEntry(String name, String[] exts, String[] mimeTypes, MagicNumberRegistryEntry.MagicNumber[] magicNumbers, float priority)` Constructor, allows for overriding the default priority of magic number entries.
`MagicNumberRegistryEntry(String name, String ext, String mimeType, int offset, byte[] magicNumber)` Constructor, simplifies construction of entry when only one extension and one magic number is required.
`MagicNumberRegistryEntry(String name, String ext, String mimeType, MagicNumberRegistryEntry.MagicNumber[] magicNumbers)` Constructor, simplifies construction of entry when only one extension is required.

Method Summary
`int` | `getReadlimit()` Returns the maximume read ahead needed for all magic numbers.
`boolean` | `isCompatibleStream(InputStream is)` Check if the stream contains an image that can be handled by this format handler

Methods inherited from class org.apache.batik.ext.awt.image.spi.AbstractRegistryEntry
`getFormatName, getMimeTypes, getPriority, getStandardExtensions`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.batik.ext.awt.image.spi.StreamRegistryEntry
`handleStream`

Methods inherited from interface org.apache.batik.ext.awt.image.spi.RegistryEntry
`getFormatName, getMimeTypes, getPriority, getStandardExtensions`

Field Detail

### PRIORITY

    public static final float PRIORITY

See Also:
  Constant Field Values

Constructor Detail

### MagicNumberRegistryEntry

    public MagicNumberRegistryEntry(String name,
                                    float priority,
                                    String ext,
                                    String mimeType,
                                    int offset,
                                    byte[] magicNumber)

  Constructor, simplifies construction of entry when only one extension and one magic number is required.

  Parameters:
    `name` - Format Name
    `priority` - the priority of the RegistryEntry
    `ext` - Standard extension
    `mimeType` - the supported MIME type
    `offset` - Offset of magic number
    `magicNumber` - byte array to match.

### MagicNumberRegistryEntry

    public MagicNumberRegistryEntry(String name,
                                    String ext,
                                    String mimeType,
                                    int offset,
                                    byte[] magicNumber)

  Constructor, simplifies construction of entry when only one extension and one magic number is required.

  Parameters:
    `name` - Format Name
    `ext` - Standard extension
    `mimeType` - the supported MIME type
    `offset` - Offset of magic number
    `magicNumber` - byte array to match.

### MagicNumberRegistryEntry

    public MagicNumberRegistryEntry(String name,
                                    float priority,
                                    String ext,
                                    String mimeType,
                                    MagicNumberRegistryEntry.MagicNumber[] magicNumbers)

  Constructor, simplifies construction of entry when only one extension is required.

  Parameters:
    `name` - Format Name
    `priority` - the priority of the RegistryEntry
    `ext` - Standard extension
    `mimeType` - the supported MIME type
    `magicNumbers` - Array of magic numbers any of which can match.

### MagicNumberRegistryEntry

    public MagicNumberRegistryEntry(String name,
                                    String ext,
                                    String mimeType,
                                    MagicNumberRegistryEntry.MagicNumber[] magicNumbers)

  Constructor, simplifies construction of entry when only one extension is required.

  Parameters:
    `name` - Format Name
    `ext` - Standard extension
    `mimeType` - the supported MIME type
    `magicNumbers` - Array of magic numbers any of which can match.

### MagicNumberRegistryEntry

    public MagicNumberRegistryEntry(String name,
                                    float priority,
                                    String[] exts,
                                    String[] mimeTypes,
                                    int offset,
                                    byte[] magicNumber)

  Constructor, simplifies construction of entry when only one magic number is required.

  Parameters:
    `name` - Format Name
    `priority` - the priority of the RegistryEntry
    `exts` - Standard set of extensions
    `mimeTypes` - array of supported MIME types
    `offset` - Offset of magic number
    `magicNumber` - byte array to match.

### MagicNumberRegistryEntry

    public MagicNumberRegistryEntry(String name,
                                    String[] exts,
                                    String[] mimeTypes,
                                    int offset,
                                    byte[] magicNumbers)

  Constructor, simplifies construction of entry when only one magic number is required.

  Parameters:
    `name` - Format Name
    `exts` - Standard set of extensions
    `mimeTypes` - array of supported MIME types
    `offset` - Offset of magic number
    `magicNumbers` - byte array to match.

### MagicNumberRegistryEntry

    public MagicNumberRegistryEntry(String name,
                                    float priority,
                                    String[] exts,
                                    String[] mimeTypes,
                                    MagicNumberRegistryEntry.MagicNumber[] magicNumbers)

  Constructor

  Parameters:
    `name` - Format Name
    `priority` - the priority of the RegistryEntry
    `exts` - Standard set of extensions
    `mimeTypes` - array of supported MIME types
    `magicNumbers` - array of magic numbers any of which can match.

### MagicNumberRegistryEntry

    public MagicNumberRegistryEntry(String name,
                                    String[] exts,
                                    String[] mimeTypes,
                                    MagicNumberRegistryEntry.MagicNumber[] magicNumbers)

  Constructor

  Parameters:
    `name` - Format Name
    `exts` - Standard set of extensions
    `mimeTypes` - array of supported MIME types
    `magicNumbers` - array of magic numbers any of which can match.

### MagicNumberRegistryEntry

    public MagicNumberRegistryEntry(String name,
                                    String[] exts,
                                    String[] mimeTypes,
                                    MagicNumberRegistryEntry.MagicNumber[] magicNumbers,
                                    float priority)

  Constructor, allows for overriding the default priority of magic number entries. This should be needed very rarely since magic number checks are fairly relyable and hence aren't usually sensative to order issues.

  Parameters:
    `name` - Format Name
    `exts` - Standard set of extensions
    `magicNumbers` - array of magic numbers any of which can match.
    `priority` - The priority of this entry (1000 is baseline)

Method Detail

### getReadlimit

    public int getReadlimit()

  Returns the maximume read ahead needed for all magic numbers.

  Specified by:
    `getReadlimit` in interface `StreamRegistryEntry`

### isCompatibleStream

    public boolean isCompatibleStream(InputStream is)
                               throws StreamCorruptedException

  Check if the stream contains an image that can be handled by this format handler

  Specified by:
    `isCompatibleStream` in interface `StreamRegistryEntry`
  Throws:
    `StreamCorruptedException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008 Apache Software Foundation. All Rights Reserved.