public class ByteOrderMark extends Object implements Predicate<byte[]>, Comparable<ByteOrderMark>, Serializable
来自:Apache-commons-io
Modifier and Type | Field and Description |
---|---|
static ByteOrderMark[] |
ALL
预定义的所有BOM信息
|
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 and Description |
---|
ByteOrderMark(String charsetName,
byte... bytes)
构造
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(ByteOrderMark o) |
boolean |
equals(Object obj) |
int |
get(int pos)
获取指定位置的byte值
|
byte[] |
getBytes()
Gets a copy of the BOM's bytes.
|
String |
getCharsetName()
获取BOM头定义的编码名称.
|
int |
hashCode() |
int |
length()
获取BOM头byte数
|
boolean |
test(byte[] headBytes)
是否匹配头部BOM信息
当提供的长度小于BOM需要检查的长度时,返回{code false} |
String |
toString() |
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
public static final ByteOrderMark[] ALL
public ByteOrderMark(String charsetName, byte... bytes)
charsetName
- BOM定义的编码名称bytes
- BOM bytesIllegalArgumentException
- 编码名称为空或者bytes为空public String getCharsetName()
public int length()
public int get(int pos)
pos
- The positionpublic byte[] getBytes()
public boolean test(byte[] headBytes)
public int compareTo(ByteOrderMark o)
compareTo
in interface Comparable<ByteOrderMark>
Copyright © 2025. All rights reserved.