|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||
java.lang.Objectjava.lang.Enum<ByteOrderMark>
net.sf.mmm.util.io.api.ByteOrderMark
public enum ByteOrderMark
This type represents a Byte-Order-Mark (BOM) of an Unicode-Transformation-Format (UTF).
| Enum Constant Summary | |
|---|---|
UTF_16_BE
The ByteOrderMark for UTF-16BE:0xfe 0xff |
|
UTF_16_LE
The ByteOrderMark for UTF16-LE:0xff 0xfe |
|
UTF_32_BE
The ByteOrderMark for UTF-32BE:0x00 0x00 0xfe 0xff |
|
UTF_32_LE
The ByteOrderMark for UTF-32LE:0xff 0xfe 0x00 0x00 |
|
UTF_8
The ByteOrderMark for UTF-8:0xef 0xbb 0xbf |
|
| Field Summary | |
|---|---|
private static byte[] |
MAGIC_BYTES_UTF16_BE
|
private static byte[] |
MAGIC_BYTES_UTF16_LE
|
private static byte[] |
MAGIC_BYTES_UTF32_BE
|
private static byte[] |
MAGIC_BYTES_UTF32_LE
|
private static byte[] |
MAGIC_BYTES_UTF8
|
| Method Summary | |
|---|---|
static ByteOrderMark |
detect(byte[] bytes,
int offset)
This method detects the ByteOrderMark that may be
present in the given bytes
starting at offset. |
protected abstract byte[] |
getBytes()
This method gets the bytes of this BOM. |
abstract String |
getEncoding()
This method gets the encoding indicated by this ByteOrderMark. |
int |
getLength()
This method gets the number of bytes of this ByteOrderMark. |
boolean |
isPresent(byte[] bytes,
int offset)
This method detects if this ByteOrderMark is present in the given
bytes. |
static ByteOrderMark |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static 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 |
|---|
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 |
|---|
public static final ByteOrderMark UTF_8
ByteOrderMark for UTF-8:0xef 0xbb 0xbf
public static final ByteOrderMark UTF_16_BE
ByteOrderMark for UTF-16BE:0xfe 0xff
public static final ByteOrderMark UTF_16_LE
ByteOrderMark for UTF16-LE:0xff 0xfe
public static final ByteOrderMark UTF_32_BE
ByteOrderMark for UTF-32BE:0x00 0x00 0xfe 0xff
public static final ByteOrderMark UTF_32_LE
ByteOrderMark for UTF-32LE:0xff 0xfe 0x00 0x00
| Field Detail |
|---|
private static final byte[] MAGIC_BYTES_UTF8
UTF_8private static final byte[] MAGIC_BYTES_UTF16_BE
UTF_16_BEprivate static final byte[] MAGIC_BYTES_UTF16_LE
UTF_16_LEprivate static final byte[] MAGIC_BYTES_UTF32_BE
UTF_32_BEprivate static final byte[] MAGIC_BYTES_UTF32_LE
UTF_32_LE| Method Detail |
|---|
public static ByteOrderMark[] values()
for (ByteOrderMark c : ByteOrderMark.values()) System.out.println(c);
public static ByteOrderMark valueOf(String name)
name - the name of the enum constant to be returned.
IllegalArgumentException - if this enum type has no constant
with the specified name
NullPointerException - if the argument is nullpublic abstract String getEncoding()
ByteOrderMark.
public final int getLength()
ByteOrderMark.
public final boolean isPresent(byte[] bytes,
int offset)
ByteOrderMark is present in the given
bytes.ByteOrderMark. This method can NOT know this and
will return true even if the data is NOT encoded with the
according encoding. Therefore you should only use
this method for the header of textual data.
bytes - is the buffer with the bytes to check.offset - is the index of the first data-byte in bytes.
Will typically be 0.
true if this BOM was detected in
theprotected abstract byte[] getBytes()
public static ByteOrderMark detect(byte[] bytes,
int offset)
ByteOrderMark that may be
present in the given bytes
starting at offset.ByteOrderMark. This method can NOT know this and will
return that ByteOrderMark even if the data is NOT encoded with the
according encoding. Therefore you should only use
this method for the header of textual data.
bytes - is the buffer with the bytes to check.offset - is the index of the first data-byte in bytes.
Will typically be 0.
ByteOrderMark or null if the
given bytes have no BOM.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD | |||||||||