public enum ByteOrderMark extends Enum<ByteOrderMark>
| Enum Constant and Description |
|---|
UTF_16_BE
|
UTF_16_LE
|
UTF_32_BE
|
UTF_32_LE
|
UTF_8
|
| Modifier and Type | Field and Description |
|---|---|
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 |
| Modifier and Type | Method and Description |
|---|---|
static ByteOrderMark |
detect(byte[] bytes,
int 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.
|
public static final ByteOrderMark UTF_8
public static final ByteOrderMark UTF_16_BE
public static final ByteOrderMark UTF_16_LE
public static final ByteOrderMark UTF_32_BE
public static final ByteOrderMark UTF_32_LE
private static final byte[] MAGIC_BYTES_UTF8
private static final byte[] MAGIC_BYTES_UTF16_BE
private static final byte[] MAGIC_BYTES_UTF16_LE
private static final byte[] MAGIC_BYTES_UTF32_BE
private static final byte[] MAGIC_BYTES_UTF32_LE
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 nameNullPointerException - 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.Copyright © 2001–2016 mmm-Team. All rights reserved.