com.j256.simplemagic.types
Class SearchType
java.lang.Object
com.j256.simplemagic.types.StringType
com.j256.simplemagic.types.SearchType
- All Implemented Interfaces:
- MagicMatcher
public class SearchType
- extends StringType
From the magic(5) man page: A literal string search starting at the given line offset. The same modifier flags can be
used as for string patterns. The modifier flags (if any) must be followed by /number the range, that is, the number
of positions at which the match will be attempted, starting from the start offset. This is suitable for searching
larger binary expressions with variable offsets, using \ escapes for special characters. The offset works as for
regex.
NOTE: in our experience, the /number is _before_ the flags in 99% of the lines so that is how we implemented
it.
- Author:
- graywatson
Method Summary |
Object |
isMatch(Object testValue,
Long andValue,
boolean unsignedType,
Object extractedValue,
int offset,
byte[] bytes)
Matches if the bytes match at a certain offset. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SearchType
public SearchType()
isMatch
public Object isMatch(Object testValue,
Long andValue,
boolean unsignedType,
Object extractedValue,
int offset,
byte[] bytes)
- Description copied from interface:
MagicMatcher
- Matches if the bytes match at a certain offset.
- Specified by:
isMatch
in interface MagicMatcher
- Overrides:
isMatch
in class StringType
- Returns:
- The extracted-value object, or null if no match.
This content is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.