com.mucommander.io.bom
Class BOM

java.lang.Object
  extended by com.mucommander.io.bom.BOM

public class BOM
extends java.lang.Object

BOM represents a Byte-Order Mark, a byte sequence that can be found at the beginning of a Unicode text stream which indicates the encoding of the text that follows.

Author:
Maxence Bernard
See Also:
BOMInputStream

Constructor Summary
BOM(byte[] signature, java.lang.String encoding)
          Creates a new BOM instance identified by the given signature and designating the specified character encoding.
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns true if and only if the given Object is a BOM instance with the same signature as this instance.
 java.lang.String getEncoding()
          Returns the character encoding that this BOM denotes.
 byte[] getSignature()
          Returns the byte sequence that identifies this BOM at the beginning of a byte stream.
 boolean sigEquals(byte[] bytes)
          Returns true if this BOM's signature matches the given byte sequence.
 boolean sigStartsWith(byte[] bytes)
          Returns true if this BOM's signature starts with the given byte sequence.
 java.lang.String toString()
          Returns a String representation of this BOM.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BOM

public BOM(byte[] signature,
           java.lang.String encoding)
Creates a new BOM instance identified by the given signature and designating the specified character encoding.

Parameters:
signature - the byte sequence that identifies this BOM
encoding - the character encoding designated by this BOM
Method Detail

getSignature

public byte[] getSignature()
Returns the byte sequence that identifies this BOM at the beginning of a byte stream.

Returns:
the byte sequence that identifies this BOM at the beginning of a byte stream

getEncoding

public java.lang.String getEncoding()
Returns the character encoding that this BOM denotes.

Returns:
the character encoding that this BOM denotes

sigStartsWith

public boolean sigStartsWith(byte[] bytes)
Returns true if this BOM's signature starts with the given byte sequence.

Parameters:
bytes - the byte sequence to compare against this BOM's signature
Returns:
true if this BOM's signature starts with the given byte sequence

sigEquals

public boolean sigEquals(byte[] bytes)
Returns true if this BOM's signature matches the given byte sequence.

Parameters:
bytes - the byte sequence to compare against this BOM's signature
Returns:
true if this BOM's signature matches the given byte sequence

equals

public boolean equals(java.lang.Object o)
Returns true if and only if the given Object is a BOM instance with the same signature as this instance. *

Overrides:
equals in class java.lang.Object
Parameters:
o - the Object to test for equality
Returns:
true if the specified Object is a BOM instance with the same signature as this instance

toString

public java.lang.String toString()
Returns a String representation of this BOM.

Overrides:
toString in class java.lang.Object
Returns:
returns a String representation of this BOM.


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard