Class ByteOrderMark
java.lang.Object
nl.siegmann.epublib.util.commons.io.ByteOrderMark
- All Implemented Interfaces:
Serializable
Byte Order Mark (BOM) representation -
see
BOMInputStream.- Since:
- Commons IO 2.0
- Version:
- $Id: ByteOrderMark.java 1005099 2010-10-06 16:13:01Z niallp $
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int[]private final Stringprivate static final longstatic final ByteOrderMarkUTF-16BE BOM (Big Endian)static final ByteOrderMarkUTF-16LE BOM (Little Endian)static final ByteOrderMarkUTF-8 BOM -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates if this BOM's bytes equals another.intget(int pos) The byte at the specified position.byte[]getBytes()Return a copy of the BOM's bytes.Return the name of theCharsetthe BOM represents.inthashCode()Return the hashcode for this BOM.intlength()Return the length of the BOM's bytes.toString()Provide a String representation of the BOM.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
UTF_8
UTF-8 BOM -
UTF_16BE
UTF-16BE BOM (Big Endian) -
UTF_16LE
UTF-16LE BOM (Little Endian) -
charsetName
-
bytes
private final int[] bytes
-
-
Constructor Details
-
ByteOrderMark
Construct a new BOM.- Parameters:
charsetName- The name of the charset the BOM representsbytes- The BOM's bytes- Throws:
IllegalArgumentException- if the charsetName is null or zero lengthIllegalArgumentException- if the bytes are null or zero length
-
-
Method Details
-
getCharsetName
Return the name of theCharsetthe BOM represents.- Returns:
- the character set name
-
length
public int length()Return the length of the BOM's bytes.- Returns:
- the length of the BOM's bytes
-
get
public int get(int pos) The byte at the specified position.- Parameters:
pos- The position- Returns:
- The specified byte
-
getBytes
public byte[] getBytes()Return a copy of the BOM's bytes.- Returns:
- a copy of the BOM's bytes
-
equals
Indicates if this BOM's bytes equals another. -
hashCode
public int hashCode()Return the hashcode for this BOM. -
toString
Provide a String representation of the BOM.
-