Class MagicNumberRegistryEntry

java.lang.Object
io.sf.carte.echosvg.ext.awt.image.spi.AbstractRegistryEntry
io.sf.carte.echosvg.ext.awt.image.spi.MagicNumberRegistryEntry
All Implemented Interfaces:
ErrorConstants, RegistryEntry, StreamRegistryEntry

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 compatibility check based on a list of Magic Numbers that correspond to your format (Some formats have multiple magic numbers associated with them).
  • Field Details

  • Constructor Details

    • 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 Details