public interface MagicMatcher
Modifier and Type | Interface and Description |
---|---|
static class |
MagicMatcher.MutableOffset
Offset which we can update.
|
Modifier and Type | Method and Description |
---|---|
Object |
convertTestString(String typeStr,
String testStr)
Converts the test-string from the magic line to be the testValue object to be passed into
isMatch(Object, Long, boolean, Object, MutableOffset, byte[]) and getStartingBytes(Object) . |
Object |
extractValueFromBytes(int offset,
byte[] bytes,
boolean required)
Extract the value from the bytes either for doing the match or rendering it in the format.
|
byte[] |
getStartingBytes(Object testValue)
Return the starting bytes of the pattern or null if none.
|
Object |
isMatch(Object testValue,
Long andValue,
boolean unsignedType,
Object extractedValue,
MagicMatcher.MutableOffset offset,
byte[] bytes)
Matches if the bytes match at a certain offset.
|
void |
renderValue(StringBuilder sb,
Object extractedValue,
MagicFormatter formatter)
Returns the string version of the extracted value.
|
Object convertTestString(String typeStr, String testStr)
isMatch(Object, Long, boolean, Object, MutableOffset, byte[])
and getStartingBytes(Object)
.Object extractValueFromBytes(int offset, byte[] bytes, boolean required)
offset
- Number of bytes into the bytes array that we are extracting from.bytes
- Array of bytes we are extracting from.required
- Whether or not the extracted value is required for later. If it is not then the type may opt to not
extract the value and to do the matching directly.isMatch(Object, Long, boolean, Object, MutableOffset, byte[])
or null
if not enough bytes.Object isMatch(Object testValue, Long andValue, boolean unsignedType, Object extractedValue, MagicMatcher.MutableOffset offset, byte[] bytes)
void renderValue(StringBuilder sb, Object extractedValue, MagicFormatter formatter)
byte[] getStartingBytes(Object testValue)
This content is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.