com.j256.simplemagic.entries
Enum MagicType

java.lang.Object
  extended by java.lang.Enum<MagicType>
      extended by com.j256.simplemagic.entries.MagicType
All Implemented Interfaces:
Serializable, Comparable<MagicType>

public enum MagicType
extends Enum<MagicType>

The various types which correspond to the "type" part of the magic (5) format.

Author:
graywatson

Enum Constant Summary
BIG_ENDIAN_DATE
          4 byte value in big-endian byte order, interpreted as a Unix date using UTC time zone.
BIG_ENDIAN_DOUBLE
          8 byte floating point number in big-endian byte order.
BIG_ENDIAN_FLOAT
          4 byte floating point number in big-endian byte order.
BIG_ENDIAN_ID3
          4 byte integer with each byte using lower 7-bits in big-endian byte order.
BIG_ENDIAN_INTEGER
          4 byte "long" integer in big-endian byte order.
BIG_ENDIAN_LOCAL_DATE
          4 byte value big-endian byte order, interpreted as a Unix date using the local time zone.
BIG_ENDIAN_LONG_DATE
          8 byte value in big-endian byte order, interpreted as a Unix date using UTC time zone.
BIG_ENDIAN_LONG_LOCAL_DATE
          8 byte value in big-endian byte order, interpreted as a Unix date using the local time zone.
BIG_ENDIAN_QUAD
          8 byte long integer in big-endian byte order.
BIG_ENDIAN_SHORT
          2 byte short integer in big-endian byte order.
BIG_ENDIAN_TWO_BYTE_STRING
          String made up of 2-byte characters in big-endian byte order.
BYTE
          Single byte value.
DATE
          4 byte value in native=endian byte order, interpreted as a Unix date using UTC time zone.
DEFAULT
          Default type that always matches.
DOUBLE
          8 byte floating point number in native-endian byte order.
FLOAT
          4 byte floating point number in native-endian byte order.
INTEGER
          4 byte "long" integer in native-endian byte order.
LITTLE_ENDIAN_DATE
          4 byte value in little-endian byte order, interpreted as a Unix date using UTC time zone.
LITTLE_ENDIAN_DOUBLE
          8 byte floating point number in little-endian byte order.
LITTLE_ENDIAN_FLOAT
          4 byte floating point number in little-endian byte order.
LITTLE_ENDIAN_ID3
          4 byte integer with each byte using lower 7-bits in little-endian byte order.
LITTLE_ENDIAN_INTEGER
          4 byte "long" integer in little-endian byte order.
LITTLE_ENDIAN_LOCAL_DATE
          4 byte value little-endian byte order, interpreted as a Unix date using the local time zone.
LITTLE_ENDIAN_LONG_DATE
          8 byte value in little-endian byte order, interpreted as a Unix date using UTC time zone.
LITTLE_ENDIAN_LONG_LOCAL_DATE
          8 byte value in little-endian byte order, interpreted as a Unix date using the local time zone.
LITTLE_ENDIAN_QUAD
          8 byte long integer in little-endian byte order.
LITTLE_ENDIAN_SHORT
          2 byte short integer in little-endian byte order.
LITTLE_ENDIAN_TWO_BYTE_STRING
          String made up of 2-byte characters in little-endian byte order.
LOCAL_DATE
          4 byte value in native-endian byte order, interpreted as a Unix date using the local time zone.
LONG_DATE
          8 byte value in native-endian byte order, interpreted as a Unix date using UTC time zone.
LONG_LOCAL_DATE
          8 byte value in native-endian byte order, interpreted as a Unix date using the local time zone.
MIDDLE_ENDIAN_DATE
          4 byte value in middle-endian byte order, interpreted as a Unix date using UTC time zone.
MIDDLE_ENDIAN_INTEGER
          4 byte "long" integer in middle-endian byte order.
MIDDLE_ENDIAN_LOCAL_DATE
          4 byte value middle-endian byte order, interpreted as a Unix date using the local time zone.
PSTRING
          Strings that are encoded with the first byte being the length of the string.
QUAD
          8 byte long integer in native-endian byte order.
REGEX
          Regex line search looking for compiled patterns.
SEARCH
          String line search looking for sub-strings.
SHORT
          2 byte short integer in native-endian byte order.
STRING
          Special string matching that supports white-space and case handling.
 
Method Summary
static MagicMatcher matcherfromString(String typeString)
          Find the associated matcher to the string.
static MagicType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static MagicType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

BYTE

public static final MagicType BYTE
Single byte value.


SHORT

public static final MagicType SHORT
2 byte short integer in native-endian byte order.


INTEGER

public static final MagicType INTEGER
4 byte "long" integer in native-endian byte order. This is C language long (shudder).


QUAD

public static final MagicType QUAD
8 byte long integer in native-endian byte order.


FLOAT

public static final MagicType FLOAT
4 byte floating point number in native-endian byte order.


DOUBLE

public static final MagicType DOUBLE
8 byte floating point number in native-endian byte order.


STRING

public static final MagicType STRING
Special string matching that supports white-space and case handling.


PSTRING

public static final MagicType PSTRING
Strings that are encoded with the first byte being the length of the string.


DATE

public static final MagicType DATE
4 byte value in native=endian byte order, interpreted as a Unix date using UTC time zone.


LONG_DATE

public static final MagicType LONG_DATE
8 byte value in native-endian byte order, interpreted as a Unix date using UTC time zone.


LOCAL_DATE

public static final MagicType LOCAL_DATE
4 byte value in native-endian byte order, interpreted as a Unix date using the local time zone.


LONG_LOCAL_DATE

public static final MagicType LONG_LOCAL_DATE
8 byte value in native-endian byte order, interpreted as a Unix date using the local time zone.


BIG_ENDIAN_ID3

public static final MagicType BIG_ENDIAN_ID3
4 byte integer with each byte using lower 7-bits in big-endian byte order.


BIG_ENDIAN_SHORT

public static final MagicType BIG_ENDIAN_SHORT
2 byte short integer in big-endian byte order.


BIG_ENDIAN_INTEGER

public static final MagicType BIG_ENDIAN_INTEGER
4 byte "long" integer in big-endian byte order. This is C language long (shudder).


BIG_ENDIAN_QUAD

public static final MagicType BIG_ENDIAN_QUAD
8 byte long integer in big-endian byte order.


BIG_ENDIAN_FLOAT

public static final MagicType BIG_ENDIAN_FLOAT
4 byte floating point number in big-endian byte order.


BIG_ENDIAN_DOUBLE

public static final MagicType BIG_ENDIAN_DOUBLE
8 byte floating point number in big-endian byte order.


BIG_ENDIAN_DATE

public static final MagicType BIG_ENDIAN_DATE
4 byte value in big-endian byte order, interpreted as a Unix date using UTC time zone.


BIG_ENDIAN_LONG_DATE

public static final MagicType BIG_ENDIAN_LONG_DATE
8 byte value in big-endian byte order, interpreted as a Unix date using UTC time zone.


BIG_ENDIAN_LOCAL_DATE

public static final MagicType BIG_ENDIAN_LOCAL_DATE
4 byte value big-endian byte order, interpreted as a Unix date using the local time zone.


BIG_ENDIAN_LONG_LOCAL_DATE

public static final MagicType BIG_ENDIAN_LONG_LOCAL_DATE
8 byte value in big-endian byte order, interpreted as a Unix date using the local time zone.


BIG_ENDIAN_TWO_BYTE_STRING

public static final MagicType BIG_ENDIAN_TWO_BYTE_STRING
String made up of 2-byte characters in big-endian byte order.


LITTLE_ENDIAN_ID3

public static final MagicType LITTLE_ENDIAN_ID3
4 byte integer with each byte using lower 7-bits in little-endian byte order.


LITTLE_ENDIAN_SHORT

public static final MagicType LITTLE_ENDIAN_SHORT
2 byte short integer in little-endian byte order.


LITTLE_ENDIAN_INTEGER

public static final MagicType LITTLE_ENDIAN_INTEGER
4 byte "long" integer in little-endian byte order. This is C language long (shudder).


LITTLE_ENDIAN_QUAD

public static final MagicType LITTLE_ENDIAN_QUAD
8 byte long integer in little-endian byte order.


LITTLE_ENDIAN_FLOAT

public static final MagicType LITTLE_ENDIAN_FLOAT
4 byte floating point number in little-endian byte order.


LITTLE_ENDIAN_DOUBLE

public static final MagicType LITTLE_ENDIAN_DOUBLE
8 byte floating point number in little-endian byte order.


LITTLE_ENDIAN_DATE

public static final MagicType LITTLE_ENDIAN_DATE
4 byte value in little-endian byte order, interpreted as a Unix date using UTC time zone.


LITTLE_ENDIAN_LONG_DATE

public static final MagicType LITTLE_ENDIAN_LONG_DATE
8 byte value in little-endian byte order, interpreted as a Unix date using UTC time zone.


LITTLE_ENDIAN_LOCAL_DATE

public static final MagicType LITTLE_ENDIAN_LOCAL_DATE
4 byte value little-endian byte order, interpreted as a Unix date using the local time zone.


LITTLE_ENDIAN_LONG_LOCAL_DATE

public static final MagicType LITTLE_ENDIAN_LONG_LOCAL_DATE
8 byte value in little-endian byte order, interpreted as a Unix date using the local time zone.


LITTLE_ENDIAN_TWO_BYTE_STRING

public static final MagicType LITTLE_ENDIAN_TWO_BYTE_STRING
String made up of 2-byte characters in little-endian byte order.


REGEX

public static final MagicType REGEX
Regex line search looking for compiled patterns.


SEARCH

public static final MagicType SEARCH
String line search looking for sub-strings.


MIDDLE_ENDIAN_INTEGER

public static final MagicType MIDDLE_ENDIAN_INTEGER
4 byte "long" integer in middle-endian byte order. This is C language long (shudder).


MIDDLE_ENDIAN_DATE

public static final MagicType MIDDLE_ENDIAN_DATE
4 byte value in middle-endian byte order, interpreted as a Unix date using UTC time zone.


MIDDLE_ENDIAN_LOCAL_DATE

public static final MagicType MIDDLE_ENDIAN_LOCAL_DATE
4 byte value middle-endian byte order, interpreted as a Unix date using the local time zone.


DEFAULT

public static final MagicType DEFAULT
Default type that always matches. Used in rule chaining.

Method Detail

values

public static MagicType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (MagicType c : MagicType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static MagicType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

matcherfromString

public static MagicMatcher matcherfromString(String typeString)
Find the associated matcher to the string.



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