com.j256.simplemagic.types
Class DoubleType

java.lang.Object
  extended by com.j256.simplemagic.types.DoubleType
All Implemented Interfaces:
MagicMatcher

public class DoubleType
extends Object
implements MagicMatcher

A 64-bit double precision IEEE floating point number in this machine's native byte order.

Author:
graywatson

Constructor Summary
DoubleType(EndianType endianType)
           
 
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 MagicMatcher.isMatch(Object, Long, boolean, 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

DoubleType

public DoubleType(EndianType endianType)
Method Detail

convertTestString

public Object convertTestString(String typeStr,
                                String testStr,
                                int offset)
Description copied from interface: MagicMatcher
Converts the test-string from the magic line to be an object to be passed into MagicMatcher.isMatch(Object, Long, boolean, Object, int, byte[]).

Specified by:
convertTestString in interface MagicMatcher

extractValueFromBytes

public Object extractValueFromBytes(int offset,
                                    byte[] bytes)
Description copied from interface: MagicMatcher
Extract the value from the bytes.

Specified by:
extractValueFromBytes in interface MagicMatcher
Returns:
The object to be passed to MagicMatcher.isMatch(Object, Long, boolean, Object, int, byte[]) or null if not enough bytes.

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
Returns:
The extracted-value object, or null if no match.

renderValue

public void renderValue(StringBuilder sb,
                        Object extractedValue,
                        Formatter formatter)
Description copied from interface: MagicMatcher
Returns the string version of the extracted value.

Specified by:
renderValue in interface MagicMatcher


This content is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.