net.sf.jmimemagic
Class MagicMatcher

java.lang.Object
  extended bynet.sf.jmimemagic.MagicMatcher
All Implemented Interfaces:
java.lang.Cloneable

public class MagicMatcher
extends java.lang.Object
implements java.lang.Cloneable

This class represents a single match test

Version:
$Revision: 1.1 $
Author:
$Author: arimus $

Constructor Summary
MagicMatcher()
          constructor
 
Method Summary
 void addSubMatcher(MagicMatcher m)
          add a submatch to this magic match
protected  java.lang.Object clone()
          DOCUMENT ME!
 java.lang.String[] getDetectorExtensions()
          Get the extensions for the underlying detectory
 MagicMatch getMatch()
          DOCUMENT ME!
 java.util.Collection getSubMatchers()
          get all submatches for this magic match
 boolean isValid()
          test to see if everything is in order for this match
 void setMatch(MagicMatch match)
          DOCUMENT ME!
 void setSubMatchers(java.util.Collection a)
          set all submatches
 MagicMatch test(byte[] data, boolean onlyMimeMatch)
          test to see if this match or any submatches match
 MagicMatch test(java.io.File f, boolean onlyMimeMatch)
          test to see if this match or any submatches match
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MagicMatcher

public MagicMatcher()
constructor

Method Detail

setMatch

public void setMatch(MagicMatch match)
DOCUMENT ME!

Parameters:
match - DOCUMENT ME!

getMatch

public MagicMatch getMatch()
DOCUMENT ME!

Returns:
DOCUMENT ME!

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(java.util.Collection a)
set all submatches

Parameters:
a - a collection of submatches

getSubMatchers

public java.util.Collection getSubMatchers()
get all submatches for this magic match

Returns:
a collection of submatches

test

public MagicMatch test(java.io.File f,
                       boolean onlyMimeMatch)
                throws java.io.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:
java.io.IOException - DOCUMENT ME!
UnsupportedTypeException - DOCUMENT ME!

test

public MagicMatch test(byte[] data,
                       boolean onlyMimeMatch)
                throws java.io.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 - DOCUMENT ME!
Returns:
the deepest magic match object that matched
Throws:
java.io.IOException - DOCUMENT ME!
UnsupportedTypeException - DOCUMENT ME!

getDetectorExtensions

public java.lang.String[] getDetectorExtensions()
Get the extensions for the underlying detectory

Returns:
DOCUMENT ME!

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
DOCUMENT ME!

Returns:
DOCUMENT ME!
Throws:
java.lang.CloneNotSupportedException - DOCUMENT ME!


Copyright © 2003-2006 none. All Rights Reserved.