Package net.sf.jmimemagic
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 TypeMethodDescriptionvoid
Add a submatch to this magic match.protected Object
clone()
boolean
descriptionMatches
(String desc) determine if this match or any submatches has the descriptionlong
get the bitmask that will be applied for this magic matchchar
get the comparator for this magic matchGet the description for this magic match.Get the extension for this magic match.int
get the length we are restricting the comparison to for this magic matchGet the magic match for this magic match.int
get 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 matchboolean
mimeTypeMatches
(String desc) determine if this match or any submatches has the descriptionvoid
setBitmask
(String value) set the bitmask that will be applied for this magic matchvoid
setComparator
(String value) set the comparator for this magic match(package private) void
setDescription
(String value) Set the description for this magic match.(package private) void
setExtension
(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
(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 matchvoid
setProperties
(Map<String, String> properties) set the properties for this magic matchvoid
Set all submatches.void
setTest
(ByteBuffer value) set the test value for thie magic matchvoid
set 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
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
set the type of match to perform for this magic match- Parameters:
value
- DOCUMENT ME!
-
getType
get the type of match for this magic match- Returns:
- DOCUMENT ME!
-
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
set the properties for this magic match- Parameters:
properties
- DOCUMENT ME!
-
getProperties
get the properties for this magic match- Returns:
- the properties for this magic match
-
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
-