Class MagicNumber


  • public class MagicNumber
    extends Object
    • Field Detail

      • DEFAULT_CHARSET

        public static final Charset DEFAULT_CHARSET
        The default charset used when loading the config file and when sampling data
      • TYPE_UNKNOWN

        public static final int TYPE_UNKNOWN
        Unknown data type id
        See Also:
        Constant Field Values
      • TYPE_BESHORT

        public static final int TYPE_BESHORT
        Big endian short data type id
        See Also:
        Constant Field Values
      • TYPE_BELONG

        public static final int TYPE_BELONG
        Big endian long data type id
        See Also:
        Constant Field Values
      • TYPE_BEDATE

        public static final int TYPE_BEDATE
        Big endian date data type id
        See Also:
        Constant Field Values
      • TYPE_LESHORT

        public static final int TYPE_LESHORT
        Little endian short data type id
        See Also:
        Constant Field Values
      • TYPE_LELONG

        public static final int TYPE_LELONG
        Little endian long data type id
        See Also:
        Constant Field Values
      • TYPE_LEDATE

        public static final int TYPE_LEDATE
        Little endian date data type id
        See Also:
        Constant Field Values
      • MAGICOPERATOR_AND

        public static final char MAGICOPERATOR_AND
        Unary Operator: Equals
        See Also:
        Constant Field Values
      • MAGICOPERATOR_GTHAN

        public static final char MAGICOPERATOR_GTHAN
        Unary Operator: Greater than
        See Also:
        Constant Field Values
      • MAGICOPERATOR_LTHAN

        public static final char MAGICOPERATOR_LTHAN
        Unary Operator: Less than
        See Also:
        Constant Field Values
      • MAGICOPERATOR_OR

        public static final char MAGICOPERATOR_OR
        Unary Operator: At least one bit matches
        See Also:
        Constant Field Values
      • MAGICOPERATOR_BWAND

        public static final char MAGICOPERATOR_BWAND
        Unary Operator: All bits match
        See Also:
        Constant Field Values
      • MAGICOPERATOR_BWNOT

        public static final char MAGICOPERATOR_BWNOT
        Unary Operator: None or some bits match
        See Also:
        Constant Field Values
      • MAGICOPERATOR_NOT

        public static final char MAGICOPERATOR_NOT
        Unary Operator: Default Operator (AND)
        See Also:
        Constant Field Values
      • MAGICOPERATOR_EQUAL_GTHAN

        public static final char MAGICOPERATOR_EQUAL_GTHAN
        Unary Operator: Greater than or equal to
        See Also:
        Constant Field Values
      • MAGICOPERATOR_EQUAL_LTHAN

        public static final char MAGICOPERATOR_EQUAL_LTHAN
        Unary operator: Less than or equal to
        See Also:
        Constant Field Values
      • MAGICOPERATOR_DEFAULT

        public static final char MAGICOPERATOR_DEFAULT
        Default Unary Operator - and
        See Also:
        Constant Field Values
      • depth

        protected int depth
      • offset

        protected int offset
      • offsetUnary

        protected char offsetUnary
      • dataType

        protected int dataType
      • dataTypeLength

        protected int dataTypeLength
      • mask

        protected byte[] mask
      • signedValue

        protected boolean signedValue
      • unaryOperator

        protected char unaryOperator
      • value

        @Nullable
        protected byte[] value
      • substitute

        protected boolean substitute
      • description

        @Nullable
        protected String description
    • Constructor Detail

      • MagicNumber

        public MagicNumber()
    • Method Detail

      • toStringAll

        public String toStringAll()
        Recreates the string entry for this magic number plus its child continuations under new lines preceded by a '>' character at the appropriate depth.
        Returns:
        String
      • describe

        @Nullable
        public String describe​(byte[] data)
        Tests the sample and if successful provides the description
      • test

        public boolean test​(byte[] data)
        Tests this magic number against the given data
      • addDependencyLayer

        public void addDependencyLayer​(MagicNumber[] dependencyLayer)
        Add child continuations
      • toString

        public String toString()
        Re-creates the string magic number entry for this number only
        Overrides:
        toString in class Object
        Returns:
        a String represention of the entry