Class MagicMatcher

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

public final class MagicMatcher extends Object implements Cloneable, Serializable
This class represents a single match test.
Version:
$Revision: 1.1 $
Author:
$Author: arimus $
See Also:
  • Constructor Details

    • MagicMatcher

      public MagicMatcher()
  • Method Details

    • setMatch

      public void setMatch(MagicMatch match)
    • getMatch

      public MagicMatch getMatch()
    • isValid

      public boolean isValid()
      Test to see if everything is in order for this match.
      Returns:
      whether or not this match has enough data to be valid.
    • addSubMatcher

      public void addSubMatcher(MagicMatcher m)
      add a submatch to this magic match
      Parameters:
      m - a magic match
    • setSubMatchers

      public void setSubMatchers(Collection<MagicMatcher> a)
      Set all submatches.
      Parameters:
      a - a collection of submatches.
    • getSubMatchers

      public Collection<MagicMatcher> getSubMatchers()
      get all submatches for this magic match
      Returns:
      a collection of submatches
    • test

      public MagicMatch test(File f, boolean onlyMimeMatch) throws IOException, UnsupportedTypeException
      test to see if this match or any submatches match
      Parameters:
      f - the file that should be used to test the match
      onlyMimeMatch - DOCUMENT ME!
      Returns:
      the deepest magic match object that matched
      Throws:
      IOException - DOCUMENT ME!
      UnsupportedTypeException - DOCUMENT ME!
    • test

      public MagicMatch test(byte[] data, boolean onlyMimeMatch) throws IOException, UnsupportedTypeException
      Test to see if this match or any submatches match.
      Parameters:
      data - the data that should be used to test the match
      onlyMimeMatch - Indica que sólo se identifique el mimetype de los datos.
      Returns:
      the deepest magic match object that matched
      Throws:
      IOException - Cuando falla la lectura de los datos.
      UnsupportedTypeException - Cuando no se identifiquen los datos.
    • getDetectorExtensions

      public String[] getDetectorExtensions()
      Get the extensions for the underlying detectory.
      Returns:
      Listado de extensiones.
    • clone

      protected Object clone() throws CloneNotSupportedException
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException