|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.j256.simplemagic.types.RegexType
public class RegexType
From the magic(5) man page: A regular expression match in extended POSIX regular expression syntax (like egrep). Regular expressions can take exponential time to process, and their performance is hard to predict, so their use is discouraged. When used in production environments, their performance should be carefully checked. The type specification can be optionally followed by /[c][s]. The 'c' flag makes the match case insensitive, while the 's' flag update the offset to the start offset of the match, rather than the end. The regular expression is tested against line N + 1 onwards, where N is the given offset. Line endings are assumed to be in the machine's native format. ^ and $ match the beginning and end of individual lines, respectively, not beginning and end of file.
Constructor Summary | |
---|---|
RegexType()
|
Method Summary | |
---|---|
Object |
convertTestString(String typeStr,
String testStr,
int offset)
Converts the test-string from the magic line to be an object to be passed into #isMatch(Object, int, byte[]) . |
Object |
extractValueFromBytes(int offset,
byte[] bytes)
Extract the value from the bytes. |
Object |
isMatch(Object testValue,
Long andValue,
boolean unsignedType,
Object extractedValue,
int offset,
byte[] bytes)
Matches if the bytes match at a certain offset. |
void |
renderValue(StringBuilder sb,
Object extractedValue,
Formatter formatter)
Returns the string version of the extracted value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RegexType()
Method Detail |
---|
public Object convertTestString(String typeStr, String testStr, int offset)
MagicMatcher
#isMatch(Object, int, byte[])
.
convertTestString
in interface MagicMatcher
public Object extractValueFromBytes(int offset, byte[] bytes)
MagicMatcher
extractValueFromBytes
in interface MagicMatcher
MagicMatcher.isMatch(Object, Long, boolean, Object, int, byte[])
or null if not
enough bytes.public Object isMatch(Object testValue, Long andValue, boolean unsignedType, Object extractedValue, int offset, byte[] bytes)
MagicMatcher
isMatch
in interface MagicMatcher
public void renderValue(StringBuilder sb, Object extractedValue, Formatter formatter)
MagicMatcher
renderValue
in interface MagicMatcher
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |