Class MagicMatch
java.lang.Object
net.sf.jmimemagic.MagicMatch
- All Implemented Interfaces:
Serializable, Cloneable
This class represents a single match test
- Version:
- $Revision: 1.10 $
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a submatch to this magic match.protected Objectclone()booleandescriptionMatches(String desc) determine if this match or any submatches has the descriptionlongget the bitmask that will be applied for this magic matchcharget the comparator for this magic matchGet the description for this magic match.Get the extension for this magic match.intget the length we are restricting the comparison to for this magic matchGet the magic match for this magic match.intget the offset in the stream we are comparing to the test value for this magic matchget the properties for this magic matchget all submatches for this magic matchgetTest()get the test value for this magic matchgetType()get the type of match for this magic matchbooleanmimeTypeMatches(String desc) determine if this match or any submatches has the descriptionvoidsetBitmask(String value) set the bitmask that will be applied for this magic matchvoidsetComparator(String value) set the comparator for this magic match(package private) voidsetDescription(String value) Set the description for this magic match.(package private) voidsetExtension(String value) Set the extension for this magic match.voidsetLength(int value) set the length we are restricting the comparison to for this magic match(package private) voidsetMimeType(String value) Set the mime type for this magic match.voidsetOffset(int value) set the offset in the stream we are comparing to the test value for this magic matchvoidsetProperties(Map<String, String> properties) set the properties for this magic matchvoidSet all submatches.voidsetTest(ByteBuffer value) set the test value for thie magic matchvoidset the type of match to perform for this magic match
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
mimeType
-
extension
-
description
-
test
private byte[] test -
offset
private int offset -
length
private int length -
type
-
bitmask
private long bitmask -
comparator
private char comparator -
subMatches
-
properties
-
-
Constructor Details
-
MagicMatch
public MagicMatch()
-
-
Method Details
-
setMimeType
Set the mime type for this magic match. -
getMimeType
Get the magic match for this magic match.- Returns:
- The magic match for this magic match
-
setExtension
Set the extension for this magic match. -
getExtension
Get the extension for this magic match.- Returns:
- the extension for this magic match
-
setDescription
Set the description for this magic match. -
getDescription
Get the description for this magic match.- Returns:
- the description for thie magic match
-
setTest
set the test value for thie magic match- Parameters:
value- DOCUMENT ME!
-
getTest
-
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
set the type of match to perform for this magic match- Parameters:
value- DOCUMENT ME!
-
getType
-
setBitmask
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
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
-
getProperties
-
addSubMatch
Add a submatch to this magic match.- Parameters:
m- a magic match
-
setSubMatches
Set all submatches.- Parameters:
a- a collection of submatches
-
getSubMatches
get all submatches for this magic match- Returns:
- a collection of submatches
-
descriptionMatches
determine if this match or any submatches has the description- Parameters:
desc- DOCUMENT ME!- Returns:
- whether or not the description matches
-
mimeTypeMatches
determine if this match or any submatches has the description- Parameters:
desc- DOCUMENT ME!- Returns:
- whether or not the description matches
-
clone
-