java.io.Serializable
public class ByteOrderMark
extends java.lang.Object
implements java.io.Serializable
BOMInputStream
.BOMInputStream
,
Wikipedia: Byte Order Mark,
W3C: Autodetection of Character Encodings
(Non-Normative),
Serialized FormModifier and Type | Field | Description |
---|---|---|
private int[] |
bytes |
|
private java.lang.String |
charsetName |
|
private static long |
serialVersionUID |
|
static ByteOrderMark |
UTF_16BE |
UTF-16BE BOM (Big-Endian)
|
static ByteOrderMark |
UTF_16LE |
UTF-16LE BOM (Little-Endian)
|
static ByteOrderMark |
UTF_32BE |
UTF-32BE BOM (Big-Endian)
|
static ByteOrderMark |
UTF_32LE |
UTF-32LE BOM (Little-Endian)
|
static ByteOrderMark |
UTF_8 |
UTF-8 BOM
|
Constructor | Description |
---|---|
ByteOrderMark(java.lang.String charsetName,
int... bytes) |
Construct a new BOM.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(java.lang.Object obj) |
Indicates if this BOM's bytes equals another.
|
int |
get(int pos) |
The byte at the specified position.
|
byte[] |
getBytes() |
Return a copy of the BOM's bytes.
|
java.lang.String |
getCharsetName() |
Return the name of the
Charset the BOM represents. |
int |
hashCode() |
Return the hashcode for this BOM.
|
int |
length() |
Return the length of the BOM's bytes.
|
java.lang.String |
toString() |
Provide a String representation of the BOM.
|
private static final long serialVersionUID
public static final ByteOrderMark UTF_8
public static final ByteOrderMark UTF_16BE
public static final ByteOrderMark UTF_16LE
public static final ByteOrderMark UTF_32BE
public static final ByteOrderMark UTF_32LE
private final java.lang.String charsetName
private final int[] bytes
public ByteOrderMark(java.lang.String charsetName, int... bytes)
charsetName
- The name of the charset the BOM representsbytes
- The BOM's bytesjava.lang.IllegalArgumentException
- if the charsetName is null or
zero lengthjava.lang.IllegalArgumentException
- if the bytes are null or zero
lengthpublic java.lang.String getCharsetName()
Charset
the BOM represents.public int length()
public int get(int pos)
pos
- The positionpublic byte[] getBytes()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to compare topublic int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright (c) 2002-2017 Apache Software Foundation