org.weborganic.ox.util
Enum CharsetDetector.ByteOrderMark

java.lang.Object
  extended by java.lang.Enum<CharsetDetector.ByteOrderMark>
      extended by org.weborganic.ox.util.CharsetDetector.ByteOrderMark
All Implemented Interfaces:
Serializable, Comparable<CharsetDetector.ByteOrderMark>
Enclosing class:
CharsetDetector

public static enum CharsetDetector.ByteOrderMark
extends Enum<CharsetDetector.ByteOrderMark>

An enumeration of byte order marks supported by this class.

Version:
1 September 2009
Author:
Christophe Lauret
See Also:
Unicode 5.0, RFC 3629: UTF8 - Section 6: Byte order mark (BOM), Wikipedia: Byte Order Mark

Enum Constant Summary
UTF16BE
          The byte-order mark for UTF-16LE (Sixteen-bit UCS Transformation Format, big-endian byte order).
UTF16LE
          The byte-order mark for UTF-16LE (Sixteen-bit UCS Transformation Format, little-endian byte order).
UTF8
          The byte-order mark for UTF-8 (Eight-bit UCS Transformation Format).
 
Method Summary
 Charset charset()
          The charset corresponding to the BOM.
 boolean matches(byte[] bom)
          Indicates whether the specified byte-order mark matches on the constants.
static CharsetDetector.ByteOrderMark valueOf(String name)
          Returns the enum constant of this type with the specified name.
static CharsetDetector.ByteOrderMark[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

UTF8

public static final CharsetDetector.ByteOrderMark UTF8
The byte-order mark for UTF-8 (Eight-bit UCS Transformation Format). xEF xBB xBF


UTF16LE

public static final CharsetDetector.ByteOrderMark UTF16LE
The byte-order mark for UTF-16LE (Sixteen-bit UCS Transformation Format, little-endian byte order). 0xFF 0xFE


UTF16BE

public static final CharsetDetector.ByteOrderMark UTF16BE
The byte-order mark for UTF-16LE (Sixteen-bit UCS Transformation Format, big-endian byte order). 0xFE 0xFF

Method Detail

values

public static CharsetDetector.ByteOrderMark[] 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 (CharsetDetector.ByteOrderMark c : CharsetDetector.ByteOrderMark.values())
    System.out.println(c);

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

valueOf

public static CharsetDetector.ByteOrderMark 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

matches

public boolean matches(byte[] bom)
Indicates whether the specified byte-order mark matches on the constants.

Parameters:
bom - The BOM array.
Returns:
true if the

charset

public Charset charset()
The charset corresponding to the BOM.

Returns:
The charset corresponding to the BOM.