org.openmdx.kernel.xml
Class ByteOrderMark

java.lang.Object
  extended by org.openmdx.kernel.xml.ByteOrderMark

public class ByteOrderMark
extends Object

Byte Order Mark

The exact bytes comprising the BOM will be whatever the Unicode character FEFF is converted into by that transformation format. In that form, the BOM serves to indicate both that it is a Unicode file, and which of the formats it is in. Examples:

Bytes Encoding Form
EF BB BF UTF-8
00 00 FE FF UTF-32, big-endian
FF FE 00 00 UTF-32, little-endian
FE FF UTF-16, big-endian
FF FE UTF-16, little-endian


Field Summary
static String[] ENCODINGS
          Each ENCODINGS entry corresponds to a REPRESENTATIONS entry.
static byte[][] REPRESENTATIONS
          Each REPRESENTATIONS entry corresponds to an ENCODINGS entry.
static char VALUE
          The unicode character point used as byte order mark.
 
Method Summary
static String readByteOrderMark(InputStream in)
          Consume the input stream's byte order mark if any and return the corresponding encoding or reset the input stream otherwise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALUE

public static final char VALUE
The unicode character point used as byte order mark.

See Also:
Constant Field Values

ENCODINGS

public static final String[] ENCODINGS
Each ENCODINGS entry corresponds to a REPRESENTATIONS entry.


REPRESENTATIONS

public static final byte[][] REPRESENTATIONS
Each REPRESENTATIONS entry corresponds to an ENCODINGS entry.

Method Detail

readByteOrderMark

public static String readByteOrderMark(InputStream in)
                                throws IOException
Consume the input stream's byte order mark if any and return the corresponding encoding or reset the input stream otherwise.

Parameters:
in - the input stream
Returns:
the byte order mark's encoding; or null in absence of a byte order mark.
Throws:
IOException


This software is published under the BSD license. Copyright © 2003-2007, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.