org.semanticdesktop.aperture.util
Class UtfUtil
java.lang.Object
org.semanticdesktop.aperture.util.UtfUtil
public class UtfUtil
- extends Object
Utility methods and classes for handling UTF (Unicode Transformation Format) streams.
Method Summary |
static byte[] |
findMatchingBOM(byte[] bytes)
Determines whether the specified byte array starts with a UTF Byte Order Mark and, if so, returns the
matching BOM constant. |
static String |
getCharsetName(byte[] byteOrderMark)
Returns the canonical charset name consistent with the specified Byte Order Mark. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UTF8_BOM
public static final byte[] UTF8_BOM
UTF16BE_BOM
public static final byte[] UTF16BE_BOM
UTF16LE_BOM
public static final byte[] UTF16LE_BOM
UTF32BE_BOM
public static final byte[] UTF32BE_BOM
UTF32LE_BOM
public static final byte[] UTF32LE_BOM
MAX_BOM_LENGTH
public static final int MAX_BOM_LENGTH
- See Also:
- Constant Field Values
UtfUtil
public UtfUtil()
findMatchingBOM
public static byte[] findMatchingBOM(byte[] bytes)
- Determines whether the specified byte array starts with a UTF Byte Order Mark and, if so, returns the
matching BOM constant.
- Parameters:
bytes
- The byte array that is tested for the presence of a UTF Byte Order Mark.
- Returns:
- The Byte Order Mark found at the start of the array (one of the constants in this class) or
'null' when a Byte Order Mark could not be found.
getCharsetName
public static String getCharsetName(byte[] byteOrderMark)
- Returns the canonical charset name consistent with the specified Byte Order Mark.
- Parameters:
byteOrderMark
- A Unicode Byte Order Mark.
- Returns:
- A canonical charset name, or null when the Byte Order Mark was not recognized.
Copyright © 2010 Aperture Development Team. All Rights Reserved.