Class ByteOrderMark
- java.lang.Object
-
- nl.siegmann.epublib.util.commons.io.ByteOrderMark
-
- All Implemented Interfaces:
java.io.Serializable
public class ByteOrderMark extends java.lang.Object implements java.io.SerializableByte Order Mark (BOM) representation - seeBOMInputStream.- Since:
- Commons IO 2.0
- Version:
- $Id: ByteOrderMark.java 1005099 2010-10-06 16:13:01Z niallp $
- See Also:
BOMInputStream, Wikipedia - Byte Order Mark, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private int[]bytesprivate java.lang.StringcharsetNameprivate static longserialVersionUIDstatic ByteOrderMarkUTF_16BEUTF-16BE BOM (Big Endian)static ByteOrderMarkUTF_16LEUTF-16LE BOM (Little Endian)static ByteOrderMarkUTF_8UTF-8 BOM
-
Constructor Summary
Constructors Constructor Description ByteOrderMark(java.lang.String charsetName, int... bytes)Construct a new BOM.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Indicates 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.java.lang.StringgetCharsetName()Return the name of theCharsetthe BOM represents.inthashCode()Return the hashcode for this BOM.intlength()Return the length of the BOM's bytes.java.lang.StringtoString()Provide a String representation of the BOM.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
UTF_8
public static final ByteOrderMark UTF_8
UTF-8 BOM
-
UTF_16BE
public static final ByteOrderMark UTF_16BE
UTF-16BE BOM (Big Endian)
-
UTF_16LE
public static final ByteOrderMark UTF_16LE
UTF-16LE BOM (Little Endian)
-
charsetName
private final java.lang.String charsetName
-
bytes
private final int[] bytes
-
-
Constructor Detail
-
ByteOrderMark
public ByteOrderMark(java.lang.String charsetName, int... bytes)Construct a new BOM.- Parameters:
charsetName- The name of the charset the BOM representsbytes- The BOM's bytes- Throws:
java.lang.IllegalArgumentException- if the charsetName is null or zero lengthjava.lang.IllegalArgumentException- if the bytes are null or zero length
-
-
Method Detail
-
getCharsetName
public java.lang.String 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
public boolean equals(java.lang.Object obj)
Indicates if this BOM's bytes equals another.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- The object to compare to- Returns:
- true if the bom's bytes are equal, otherwise false
-
hashCode
public int hashCode()
Return the hashcode for this BOM.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hashcode for this BOM.
- See Also:
Object.hashCode()
-
toString
public java.lang.String toString()
Provide a String representation of the BOM.- Overrides:
toStringin classjava.lang.Object- Returns:
- the length of the BOM's bytes
-
-