Package com.gengoai.io
Enum CommonBOM
- java.lang.Object
-
- java.lang.Enum<CommonBOM>
-
- com.gengoai.io.CommonBOM
-
- All Implemented Interfaces:
Serializable
,Comparable<CommonBOM>
public enum CommonBOM extends Enum<CommonBOM>
Enumeration of common Unicode Byte Order Marks- Author:
- David B. Bracewell
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_BOM_SIZE
The constant MAX_BOM_SIZE.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Charset
getCharset()
The charset associated with the bomint
length()
The number of byhtes in the bomboolean
matches(byte[] rhs)
Determines if the BOM is at the beginning of a given byte array.static CommonBOM
valueOf(String name)
Returns the enum constant of this type with the specified name.static CommonBOM[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
UTF_8
public static final CommonBOM UTF_8
The UTF_8 BOM
-
UTF_16BE
public static final CommonBOM UTF_16BE
The UTF_16BE BOM.
-
UTF_16LE
public static final CommonBOM UTF_16LE
The UTF_16LE BOM.
-
UTF_32BE
public static final CommonBOM UTF_32BE
The UTF_32BE BOM.
-
UTF_32LE
public static final CommonBOM UTF_32LE
The UTF_32LE BOM.
-
-
Method Detail
-
values
public static CommonBOM[] 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 (CommonBOM c : CommonBOM.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CommonBOM 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 nameNullPointerException
- if the argument is null
-
length
public int length()
The number of byhtes in the bom- Returns:
- The BOM length
-
getCharset
public Charset getCharset()
The charset associated with the bom- Returns:
- The associated
Charset
-
matches
public boolean matches(byte[] rhs)
Determines if the BOM is at the beginning of a given byte array.- Parameters:
rhs
- The byte array to compare against- Returns:
- True if the BOM is present, false otherwise
-
-