Package org.apache.commons.io
Class ByteOrderMark
java.lang.Object
org.apache.commons.io.ByteOrderMark
- All Implemented Interfaces:
- Serializable
Byte Order Mark (BOM) representation. See 
BOMInputStream.
 We define the follow BOM constants:
Deprecating Serialization
Serialization is deprecated and will be removed in 3.0.
- Since:
- 2.0
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final ByteOrderMarkUTF-16BE BOM (Big-Endian).static final ByteOrderMarkUTF-16LE BOM (Little-Endian).static final ByteOrderMarkUTF-32BE BOM (Big-Endian).static final ByteOrderMarkUTF-32LE BOM (Little-Endian).static final ByteOrderMarkUTF-8 BOM.static final charUnicode BOM character; external form depends on the encoding.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleanIndicates if this instance's bytes equals another.intget(int pos) Gets the byte at the specified position.byte[]getBytes()Gets a copy of the BOM's bytes.Gets the name of theCharsetthe BOM represents.inthashCode()Computes the hash code for this BOM.intlength()Gets the length of the BOM's bytes.booleanmatches(int[] test) Tests whether the given array starts with the bytes for this BOM.toString()Converts this instance to a String representation of the BOM.
- 
Field Details- 
UTF_8UTF-8 BOM.This BOM is: 0xEF 0xBB 0xBF 
- 
UTF_16BEUTF-16BE BOM (Big-Endian).This BOM is: 0xFE 0xFF 
- 
UTF_16LEUTF-16LE BOM (Little-Endian).This BOM is: 0xFF 0xFE 
- 
UTF_32BEUTF-32BE BOM (Big-Endian).This BOM is: 0x00 0x00 0xFE 0xFF - Since:
- 2.2
 
- 
UTF_32LEUTF-32LE BOM (Little-Endian).This BOM is: 0xFF 0xFE 0x00 0x00 - Since:
- 2.2
 
- 
UTF_BOMUnicode BOM character; external form depends on the encoding.- Since:
- 2.5
- See Also:
 
 
- 
- 
Constructor Details- 
ByteOrderMarkConstructs a new instance.- Parameters:
- charsetName- The name of the charset the BOM represents
- bytes- The BOM's bytes
- Throws:
- IllegalArgumentException- if the charsetName is zero length
- IllegalArgumentException- if the bytes are zero length
 
 
- 
- 
Method Details- 
equalsIndicates if this instance's bytes equals another.
- 
getGets the byte at the specified position.- Parameters:
- pos- The position
- Returns:
- The specified byte
 
- 
getBytesGets a copy of the BOM's bytes.- Returns:
- a copy of the BOM's bytes
 
- 
getCharsetNameGets the name of theCharsetthe BOM represents.- Returns:
- the character set name
 
- 
hashCodeComputes the hash code for this BOM.
- 
lengthGets the length of the BOM's bytes.- Returns:
- the length of the BOM's bytes
 
- 
matchesTests whether the given array starts with the bytes for this BOM.- Parameters:
- test- the array to test.
- Returns:
- whether the given array starts with the bytes for this BOM.
- Since:
- 2.19.0
 
- 
toStringConverts this instance to a String representation of the BOM.
 
-