"

2013 FRC Java API

"

com.sun.cldc.i18n
Class Helper

java.lang.Object
  extended by com.sun.cldc.i18n.Helper

public class Helper
extends Object

This class provides general helper functions for the J2ME environment.

No application code should reference this class directly.

Version:
CLDC 1.1 03/29/02

Field Summary
static String defaultEncoding
          The name of the default character encoding - hardcoded here and in System.getProperty().
static boolean ISO8859_1_ONLY_SUPPORTED
          If set to true, then ONLY support ISO8859_1 encodings, although aliases (such as "US_ASCII") are allowed.
 
Method Summary
static char[] byteToCharArray(byte[] buffer, int offset, int length)
          Convert a byte array to a char array
static char[] byteToCharArray(byte[] buffer, int offset, int length, String enc)
          Convert a byte array to a char array
static byte[] charToByteArray(char[] buffer, int offset, int length)
          Convert a char array to a byte array
static byte[] charToByteArray(char[] buffer, int offset, int length, String enc)
          Convert a byte array to a char array
static Reader getStreamReader(InputStream is)
          Get a reader for an InputStream
static Reader getStreamReader(InputStream is, String name)
          Get a reader for an InputStream
static Writer getStreamWriter(OutputStream os)
          Get a writer for an OutputStream
static Writer getStreamWriter(OutputStream os, String name)
          Get a writer for an OutputStream
static boolean isISO8859_1(String encodingName)
          Is encodingName some variation of "ISO8859_1"?
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultEncoding

public static final String defaultEncoding
The name of the default character encoding - hardcoded here and in System.getProperty().

See Also:
Constant Field Values

ISO8859_1_ONLY_SUPPORTED

public static final boolean ISO8859_1_ONLY_SUPPORTED
If set to true, then ONLY support ISO8859_1 encodings, although aliases (such as "US_ASCII") are allowed.

See Also:
Constant Field Values
Method Detail

getStreamReader

public static Reader getStreamReader(InputStream is)
Get a reader for an InputStream

Parameters:
is - The input stream the reader is for
Returns:
A new reader for the stream

getStreamReader

public static Reader getStreamReader(InputStream is,
                                     String name)
                              throws UnsupportedEncodingException
Get a reader for an InputStream

Parameters:
is - The input stream the reader is for
name - The name of the decoder
Returns:
A new reader for the stream
Throws:
UnsupportedEncodingException - If the encoding is not known

getStreamWriter

public static Writer getStreamWriter(OutputStream os)
Get a writer for an OutputStream

Parameters:
os - The output stream the reader is for
Returns:
A new writer for the stream

getStreamWriter

public static Writer getStreamWriter(OutputStream os,
                                     String name)
                              throws UnsupportedEncodingException
Get a writer for an OutputStream

Parameters:
os - The output stream the reader is for
name - The name of the decoder
Returns:
A new writer for the stream
Throws:
UnsupportedEncodingException - If the encoding is not known

byteToCharArray

public static char[] byteToCharArray(byte[] buffer,
                                     int offset,
                                     int length)
Convert a byte array to a char array

Parameters:
buffer - The byte array buffer
offset - The offset
length - The length
Returns:
A new char array

charToByteArray

public static byte[] charToByteArray(char[] buffer,
                                     int offset,
                                     int length)
Convert a char array to a byte array

Parameters:
buffer - The char array buffer
offset - The offset
length - The length
Returns:
A new byte array

byteToCharArray

public static char[] byteToCharArray(byte[] buffer,
                                     int offset,
                                     int length,
                                     String enc)
                              throws UnsupportedEncodingException
Convert a byte array to a char array

Parameters:
buffer - The byte array buffer
offset - The offset
length - The length
enc - The character encoding
Returns:
A new char array
Throws:
UnsupportedEncodingException - If the encoding is not known

charToByteArray

public static byte[] charToByteArray(char[] buffer,
                                     int offset,
                                     int length,
                                     String enc)
                              throws UnsupportedEncodingException
Convert a byte array to a char array

Parameters:
buffer - The byte array buffer
offset - The offset
length - The length
enc - The character encoding
Returns:
A new char array
Throws:
UnsupportedEncodingException - If the encoding is not known

isISO8859_1

public static boolean isISO8859_1(String encodingName)
Is encodingName some variation of "ISO8859_1"?

Parameters:
encodingName -
Returns:
true if encodingName is some variation of "ISO8859_1".

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"