Package net.sf.jmimemagic
Class MagicMatch
- java.lang.Object
-
- net.sf.jmimemagic.MagicMatch
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public final class MagicMatch extends java.lang.Object implements java.lang.Cloneable, java.io.SerializableThis class represents a single match test- Version:
- $Revision: 1.10 $
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private longbitmaskprivate charcomparatorprivate java.lang.Stringdescriptionprivate java.lang.Stringextensionprivate intlengthprivate java.lang.StringmimeTypeprivate intoffsetprivate java.util.Map<java.lang.String,java.lang.String>propertiesprivate static longserialVersionUIDprivate java.util.ArrayList<MagicMatch>subMatchesprivate byte[]testprivate java.lang.Stringtype
-
Constructor Summary
Constructors Constructor Description MagicMatch()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSubMatch(MagicMatch m)Add a submatch to this magic match.protected java.lang.Objectclone()booleandescriptionMatches(java.lang.String desc)determine if this match or any submatches has the descriptionlonggetBitmask()get the bitmask that will be applied for this magic matchchargetComparator()get the comparator for this magic matchjava.lang.StringgetDescription()Get the description for this magic match.java.lang.StringgetExtension()Get the extension for this magic match.intgetLength()get the length we are restricting the comparison to for this magic matchjava.lang.StringgetMimeType()Get the magic match for this magic match.intgetOffset()get the offset in the stream we are comparing to the test value for this magic matchjava.util.Map<java.lang.String,java.lang.String>getProperties()get the properties for this magic matchjava.util.Collection<MagicMatch>getSubMatches()get all submatches for this magic matchjava.nio.ByteBuffergetTest()get the test value for this magic matchjava.lang.StringgetType()get the type of match for this magic matchbooleanmimeTypeMatches(java.lang.String desc)determine if this match or any submatches has the descriptionvoidsetBitmask(java.lang.String value)set the bitmask that will be applied for this magic matchvoidsetComparator(java.lang.String value)set the comparator for this magic match(package private) voidsetDescription(java.lang.String value)Set the description for this magic match.(package private) voidsetExtension(java.lang.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(java.lang.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(java.util.Map<java.lang.String,java.lang.String> properties)set the properties for this magic matchvoidsetSubMatches(java.util.Collection<MagicMatch> a)Set all submatches.voidsetTest(java.nio.ByteBuffer value)set the test value for thie magic matchvoidsetType(java.lang.String value)set the type of match to perform for this magic match
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
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
-
-
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:
clonein classjava.lang.Object
-
-