Class MagicMatch

java.lang.Object
net.sf.jmimemagic.MagicMatch
All Implemented Interfaces:
Serializable, Cloneable

public final class MagicMatch extends Object implements Cloneable, Serializable
This class represents a single match test
Version:
$Revision: 1.10 $
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • mimeType

      private String mimeType
    • extension

      private String extension
    • description

      private String description
    • test

      private byte[] test
    • offset

      private int offset
    • length

      private int length
    • type

      private String type
    • bitmask

      private long bitmask
    • comparator

      private char comparator
    • subMatches

      private final ArrayList<MagicMatch> subMatches
    • properties

      private Map<String,String> properties
  • Constructor Details

    • MagicMatch

      public MagicMatch()
  • Method Details

    • setMimeType

      void setMimeType(String value)
      Set the mime type for this magic match.
    • getMimeType

      public String getMimeType()
      Get the magic match for this magic match.
      Returns:
      The magic match for this magic match
    • setExtension

      void setExtension(String value)
      Set the extension for this magic match.
    • getExtension

      public String getExtension()
      Get the extension for this magic match.
      Returns:
      the extension for this magic match
    • setDescription

      void setDescription(String value)
      Set the description for this magic match.
    • getDescription

      public String getDescription()
      Get the description for this magic match.
      Returns:
      the description for thie magic match
    • setTest

      public void setTest(ByteBuffer value)
      set the test value for thie magic match
      Parameters:
      value - DOCUMENT ME!
    • getTest

      public ByteBuffer getTest()
      get the test value for this magic match
      Returns:
      DOCUMENT ME!
    • setOffset

      public void setOffset(int value)
      set the offset in the stream we are comparing to the test value for this magic match
      Parameters:
      value - DOCUMENT ME!
    • getOffset

      public int getOffset()
      get the offset in the stream we are comparing to the test value for this magic match
      Returns:
      the offset for this magic match
    • setLength

      public void setLength(int value)
      set the length we are restricting the comparison to for this magic match
      Parameters:
      value - DOCUMENT ME!
    • getLength

      public int getLength()
      get the length we are restricting the comparison to for this magic match
      Returns:
      DOCUMENT ME!
    • setType

      public void setType(String value)
      set the type of match to perform for this magic match
      Parameters:
      value - DOCUMENT ME!
    • getType

      public String getType()
      get the type of match for this magic match
      Returns:
      DOCUMENT ME!
    • setBitmask

      public void setBitmask(String value)
      set the bitmask that will be applied for this magic match
      Parameters:
      value - DOCUMENT ME!
    • getBitmask

      public long getBitmask()
      get the bitmask that will be applied for this magic match
      Returns:
      the bitmask for this magic match
    • setComparator

      public void setComparator(String value)
      set the comparator for this magic match
      Parameters:
      value - DOCUMENT ME!
    • getComparator

      public char getComparator()
      get the comparator for this magic match
      Returns:
      the comparator for this magic match
    • setProperties

      public void setProperties(Map<String,String> properties)
      set the properties for this magic match
      Parameters:
      properties - DOCUMENT ME!
    • getProperties

      public Map<String,String> getProperties()
      get the properties for this magic match
      Returns:
      the properties for this magic match
    • addSubMatch

      public void addSubMatch(MagicMatch m)
      Add a submatch to this magic match.
      Parameters:
      m - a magic match
    • setSubMatches

      public void setSubMatches(Collection<MagicMatch> a)
      Set all submatches.
      Parameters:
      a - a collection of submatches
    • getSubMatches

      public Collection<MagicMatch> getSubMatches()
      get all submatches for this magic match
      Returns:
      a collection of submatches
    • descriptionMatches

      public boolean descriptionMatches(String desc)
      determine if this match or any submatches has the description
      Parameters:
      desc - DOCUMENT ME!
      Returns:
      whether or not the description matches
    • mimeTypeMatches

      public boolean mimeTypeMatches(String desc)
      determine if this match or any submatches has the description
      Parameters:
      desc - DOCUMENT ME!
      Returns:
      whether or not the description matches
    • clone

      protected Object clone()
      Overrides:
      clone in class Object