Class MagicMatch

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

    public final class MagicMatch
    extends java.lang.Object
    implements java.lang.Cloneable, java.io.Serializable
    This class represents a single match test
    Version:
    $Revision: 1.10 $
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      MagicMatch()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addSubMatch​(MagicMatch m)
      Add a submatch to this magic match.
      protected java.lang.Object clone()  
      boolean descriptionMatches​(java.lang.String desc)
      determine if this match or any submatches has the description
      long getBitmask()
      get the bitmask that will be applied for this magic match
      char getComparator()
      get the comparator for this magic match
      java.lang.String getDescription()
      Get the description for this magic match.
      java.lang.String getExtension()
      Get the extension for this magic match.
      int getLength()
      get the length we are restricting the comparison to for this magic match
      java.lang.String getMimeType()
      Get the magic match for this magic match.
      int getOffset()
      get the offset in the stream we are comparing to the test value for this magic match
      java.util.Map<java.lang.String,​java.lang.String> getProperties()
      get the properties for this magic match
      java.util.Collection<MagicMatch> getSubMatches()
      get all submatches for this magic match
      java.nio.ByteBuffer getTest()
      get the test value for this magic match
      java.lang.String getType()
      get the type of match for this magic match
      boolean mimeTypeMatches​(java.lang.String desc)
      determine if this match or any submatches has the description
      void setBitmask​(java.lang.String value)
      set the bitmask that will be applied for this magic match
      void setComparator​(java.lang.String value)
      set the comparator for this magic match
      (package private) void setDescription​(java.lang.String value)
      Set the description for this magic match.
      (package private) void setExtension​(java.lang.String value)
      Set the extension for this magic match.
      void setLength​(int value)
      set the length we are restricting the comparison to for this magic match
      (package private) void setMimeType​(java.lang.String value)
      Set the mime type for this magic match.
      void setOffset​(int value)
      set the offset in the stream we are comparing to the test value for this magic match
      void setProperties​(java.util.Map<java.lang.String,​java.lang.String> properties)
      set the properties for this magic match
      void setSubMatches​(java.util.Collection<MagicMatch> a)
      Set all submatches.
      void setTest​(java.nio.ByteBuffer value)
      set the test value for thie magic match
      void setType​(java.lang.String value)
      set the type of match to perform for this magic match
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mimeType

        private java.lang.String mimeType
      • extension

        private java.lang.String extension
      • description

        private java.lang.String description
      • test

        private byte[] test
      • offset

        private int offset
      • length

        private int length
      • type

        private java.lang.String type
      • bitmask

        private long bitmask
      • comparator

        private char comparator
      • subMatches

        private final java.util.ArrayList<MagicMatch> subMatches
      • properties

        private java.util.Map<java.lang.String,​java.lang.String> properties
    • Constructor Detail

      • MagicMatch

        public MagicMatch()
    • Method Detail

      • setMimeType

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

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

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

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

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

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

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

        public java.nio.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​(java.lang.String value)
        set the type of match to perform for this magic match
        Parameters:
        value - DOCUMENT ME!
      • getType

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

        public void setBitmask​(java.lang.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​(java.lang.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​(java.util.Map<java.lang.String,​java.lang.String> properties)
        set the properties for this magic match
        Parameters:
        properties - DOCUMENT ME!
      • getProperties

        public java.util.Map<java.lang.String,​java.lang.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​(java.util.Collection<MagicMatch> a)
        Set all submatches.
        Parameters:
        a - a collection of submatches
      • getSubMatches

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

        public boolean descriptionMatches​(java.lang.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​(java.lang.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 java.lang.Object clone()
        Overrides:
        clone in class java.lang.Object