Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.io
Class ByteOrderMark

    java.lang.Object
      org.apache.commons.io.ByteOrderMark

All Implemented Interfaces:
  Serializable

    public class ByteOrderMark

extends Object
implements 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:
  `BOMInputStream`, Wikipedia - Byte Order Mark, Serialized Form

Field Summary
`static ByteOrderMark` | `UTF_16BE` UTF-16BE BOM (Big Endian)
`static ByteOrderMark` | `UTF_16LE` UTF-16LE BOM (Little Endian)
`static ByteOrderMark` | `UTF_8` UTF-8 BOM

Constructor Summary
`ByteOrderMark(String charsetName, int... bytes)` Construct a new BOM.

Method Summary
`boolean` | `equals(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.
`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.
`String` | `toString()` Provide a String representation of the BOM.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### 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)

Constructor Detail

### ByteOrderMark

    public ByteOrderMark(String charsetName,
                         int... bytes)

  Construct a new BOM.

  Parameters:
    `charsetName` - The name of the charset the BOM represents
    `bytes` - The BOM's bytes
  Throws:
    `IllegalArgumentException` - if the charsetName is null or zero length
    `IllegalArgumentException` - if the bytes are null or zero length

Method Detail

### getCharsetName

    public String getCharsetName()

  Return the name of the `Charset` the 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(Object obj)

  Indicates if this BOM's bytes equals another.

  Overrides:
    `equals` in class `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:
    `hashCode` in class `Object`
  Returns:
    the hashcode for this BOM.
  See Also:
    `Object.hashCode()`

### toString

    public String toString()

  Provide a String representation of the BOM.

  Overrides:
    `toString` in class `Object`
  Returns:
    the length of the BOM's bytes

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2011 The Apache Software Foundation. All Rights Reserved.