net.rim.pushsdk.commons
Class StringEncoder

java.lang.Object
  extended by net.rim.pushsdk.commons.StringEncoder

public class StringEncoder
extends Object

Encodes a given string to a set of bytes using a specified character set. If no character set is specified, it will use the default platform file encoding. This can be set with the file.encoding system property (i.e. -Dfile.encoding=UTF-8).

Author:
mdicesare

Field Summary
static String CHARSET_ISO8859_1_VALUE
          The ISO-8859-1 character set.
static String CHARSET_UTF_8_VALUE
          The UTF-8 character set.
 
Constructor Summary
StringEncoder()
           
 
Method Summary
static byte[] encodeAsBytes(String data, String charset)
          Encodes the data in the specified charset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHARSET_UTF_8_VALUE

public static final String CHARSET_UTF_8_VALUE
The UTF-8 character set.

See Also:
Constant Field Values

CHARSET_ISO8859_1_VALUE

public static final String CHARSET_ISO8859_1_VALUE
The ISO-8859-1 character set.

See Also:
Constant Field Values
Constructor Detail

StringEncoder

public StringEncoder()
Method Detail

encodeAsBytes

public static byte[] encodeAsBytes(String data,
                                   String charset)
Encodes the data in the specified charset. If no charset is specified or if the charset is unknown, then the default platform file encoding will be used (-Dfile.encoding).

Parameters:
data - the data to encode
charset - the character set to encode the String into bytes
Returns:
the encoded String


Copyright © 2011 Research In Motion. All Rights Reserved.