com.plumtree.openfoundation.util
Class XPEncoding

java.lang.Object
  extended by com.plumtree.openfoundation.util.XPEncoding

public final class XPEncoding
extends java.lang.Object

Provides methods to convert arrays and strings of Unicode characters to a specific encoding.
For the methods of this class, if the supplied encoding name is one of ISO-8859-1, ISO8859_1, 8859_1, ISO8859-1, latin1, the actual encoding used will be Windows-1252, to allow "faux" ISO-8859-1 documents to render the Euro sign (0x80, U+20AC) as well as right single quotation (0x92) and en- and em-dash (0x96, 0x97). Windows-1252 is a superset (in terms of displayable characters) of ISO-8859-1.
Since this class has only static methods, it is declared final.


Field Summary
static java.lang.String ISO_8859_1_STRICT
          Refer to this encoding name to avoid aliasing of ISO-8859-1 to Windows-1252 if desired.
 
Method Summary
static byte[] GetBytes(java.lang.String str, java.lang.String encoding)
          Convert this String into bytes according to the specified character encoding, storing the result into the byte array.
static java.lang.String GetString(byte[] bytes, java.lang.String encoding)
          Construct a new String by converting the specified array of bytes using the specified character encoding.
static java.lang.String GetString(java.lang.String str, java.lang.String encoding)
          Construct a new String by converting the given string using the specified character encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ISO_8859_1_STRICT

public static java.lang.String ISO_8859_1_STRICT
Refer to this encoding name to avoid aliasing of ISO-8859-1 to Windows-1252 if desired.

Method Detail

GetBytes

public static byte[] GetBytes(java.lang.String str,
                              java.lang.String encoding)
Convert this String into bytes according to the specified character encoding, storing the result into the byte array. If encoding is not specified, it will default to XPStringUtility.DEFAULT_ENCODING. If encoding is one of ISO-8859-1, ISO8859_1, 8859_1, ISO8859-1, latin1, the actual encoding used will be Windows-1252, to allow "faux" ISO-8859-1 documents to render the Euro sign.

Parameters:
str - - the string to be encoded
encoding - - the name of the encoding
Returns:
A byte array containing the encoded representation of the specified string.

GetString

public static java.lang.String GetString(java.lang.String str,
                                         java.lang.String encoding)
Construct a new String by converting the given string using the specified character encoding. If encoding is not specified, it will default to XPStringUtility.DEFAULT_ENCODING.

Parameters:
str - - the string to be encoded
encoding - - the name of the encoding
Returns:
encoded string

GetString

public static java.lang.String GetString(byte[] bytes,
                                         java.lang.String encoding)
Construct a new String by converting the specified array of bytes using the specified character encoding. If encoding is not specified, it will default to XPStringUtility.DEFAULT_ENCODING.

Parameters:
bytes - - array of byte to be converted
encoding - - the name of the encoding
Returns:
encoded string


Copyright © 2002, 2003, 2004 Plumtree Software Inc. All Rights Reserved.