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 $
Author:
$Author: arimus $
See Also:
  • Constructor Details

    • MagicMatch

      public MagicMatch()
  • Method Details

    • getMimeType

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

      public String getExtension()
      Get the extension for this magic match.
      Returns:
      the extension 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