DCT Lightfoot v3 API specification

com.dctl.j2me.i18n
Interface Converter

All Known Implementing Classes:
SimpleConverter

public interface Converter


Method Summary
 int compareIgnoreCase(char[] c1, int o1, char[] c2, int o2, int len)
          Compare two character arrays ignoring the characters' case
 byte[] fromCharacters(char[] c)
          Create an array of bytes from an array of characters
 byte[] fromCharacters(char[] c, char[] enc)
          Create an array of bytes from an array of characters using the specified encoding
 byte[] fromCharacters(char[] c, int offset, int length)
          Create an array of bytes from an array of characters
 byte[] fromCharacters(char[] c, int offset, int length, char[] enc)
          Create an array of bytes from an array of characters using the specified encoding
 int getDigitValue(char ch, int radix)
          Get the digit value of the character in the specified radix
 boolean isDigit(char ch)
          Is char a digit?
 boolean isLowerCase(char ch)
          Is it in lower case?
 boolean isUpperCase(char ch)
          Is it in upper case?
 boolean isWhiteSpace(char ch)
          Return true if the character is white space
 char[] lowerCaseCopy(char[] c, int o, int l)
          Copy a char array into a new array, converting all chars to lower case
 int readCharacter(InputStream is)
          Read a single character from an InputStream
 int readCharacters(char[] c, int off, int len, InputStream is)
          Read multiple characters from an InputStream into an array
 char[] toCharacters(byte[] b)
          Create an array of characters from an array of bytes
 char[] toCharacters(byte[] b, char[] enc)
          Create an array of characters from an array of bytes using the specified encoding
 char[] toCharacters(byte[] b, int offset, int length)
          Create an array of characters from an array of bytes
 char[] toCharacters(byte[] b, int offset, int length, char[] enc)
          Create an array of characters from an array of bytes using the specified encoding
 char toLowerCase(char ch)
          Convert char to lower case
 void toLowerCase(char[] ch, int offset, int len)
          Convert the given array of characters to lower case
 char toUpperCase(char ch)
          Convert a block of characters to upper case
 void toUpperCase(char[] ch, int offset, int len)
          Convert the given array of characters to upper case This modifies the original array! It is a one-way function, once it has been run you can never go back to what you had so be very careful if you ever call it on a string!
 char[] trimWhiteSpace(char[] c, int o, int l)
          Trim white space off the ends of the string.
 char[] upperCaseCopy(char[] c, int o, int l)
          Copy a char array into a new array, converting all chars to upper case
 void writeCharacter(char c, OutputStream os)
          Write a single character to the specified OutputStream
 void writeCharacters(char[] c, int off, int len, OutputStream os)
          Sends an array of characters directly to a specified OutputStream
 void writeCharacters(char[] c, OutputStream os)
          Sends an array of characters directly to a specified OutputStream
 

Method Detail

compareIgnoreCase

public int compareIgnoreCase(char[] c1,
                             int o1,
                             char[] c2,
                             int o2,
                             int len)
Compare two character arrays ignoring the characters' case

Parameters:
c1 - first character array
o1 - offset into the first character array
c2 - second character array
o2 - offset into the second character array
len - number of chars to compare
Returns:
<0 if c1 < c2, 0 if c1 == c2 and >0 if c1 > c2

fromCharacters

public byte[] fromCharacters(char[] c)
Create an array of bytes from an array of characters

Parameters:
c - a char array
Returns:
a byte array

fromCharacters

public byte[] fromCharacters(char[] c,
                             char[] enc)
Create an array of bytes from an array of characters using the specified encoding

Parameters:
c - a char array
enc - The encoding (IGNORED)
Returns:
a byte array

fromCharacters

public byte[] fromCharacters(char[] c,
                             int offset,
                             int length)
Create an array of bytes from an array of characters

Parameters:
c - a char array
offset - The offset into the byte array
length - The number of bytes to convert
Returns:
a byte array

fromCharacters

public byte[] fromCharacters(char[] c,
                             int offset,
                             int length,
                             char[] enc)
Create an array of bytes from an array of characters using the specified encoding

Parameters:
c - a char array
offset - The offset into the byte array
length - The number of bytes to convert
enc - The encoding (IGNORED)
Returns:
a byte array

getDigitValue

public int getDigitValue(char ch,
                         int radix)
Get the digit value of the character in the specified radix

Parameters:
ch - The value
radix - The radix
Returns:
the numeric value or -1 if the character could not be converted in the given radix.

isDigit

public boolean isDigit(char ch)
Is char a digit?

Parameters:
ch - The value
Returns:
true if it is a digit

isLowerCase

public boolean isLowerCase(char ch)
Is it in lower case?

Parameters:
ch - The value
Returns:
true if it is

isUpperCase

public boolean isUpperCase(char ch)
Is it in upper case?

Parameters:
ch - The value
Returns:
true if it is

isWhiteSpace

public boolean isWhiteSpace(char ch)
Return true if the character is white space

Parameters:
ch - The value
Returns:
true if it is white space

lowerCaseCopy

public char[] lowerCaseCopy(char[] c,
                            int o,
                            int l)
Copy a char array into a new array, converting all chars to lower case

Parameters:
c - The character array
o - The offset into it
l - The length
Returns:
a new array which is a lower case copy of 'c'

readCharacter

public int readCharacter(InputStream is)
                  throws IOException
Read a single character from an InputStream

Parameters:
is - The input stream
Returns:
the character read
Throws:
IOException - if there is an IO error

readCharacters

public int readCharacters(char[] c,
                          int off,
                          int len,
                          InputStream is)
                   throws IOException
Read multiple characters from an InputStream into an array

Parameters:
c - The character array to read into
off - The offset into it
len - The length
is - The input stream
Returns:
the characters read
Throws:
IOException - if there is a problem

toCharacters

public char[] toCharacters(byte[] b)
Create an array of characters from an array of bytes

Parameters:
b - The byte array
Returns:
a char array

toCharacters

public char[] toCharacters(byte[] b,
                           char[] enc)
Create an array of characters from an array of bytes using the specified encoding

Parameters:
b - The bytes
enc - The encoding (currently IGNORED)
Returns:
a char array

toCharacters

public char[] toCharacters(byte[] b,
                           int offset,
                           int length)
Create an array of characters from an array of bytes

Parameters:
b - The byte array
offset - The offset into the byte array
length - The number of bytes to convert
Returns:
a char array

toCharacters

public char[] toCharacters(byte[] b,
                           int offset,
                           int length,
                           char[] enc)
Create an array of characters from an array of bytes using the specified encoding

Parameters:
b - The byte array
offset - The offset into the byte array
length - The number of bytes to convert
enc - The encoding (IGNORED)
Returns:
a char array

toLowerCase

public char toLowerCase(char ch)
Convert char to lower case

Parameters:
ch - The value
Returns:
the lower case value

toLowerCase

public void toLowerCase(char[] ch,
                        int offset,
                        int len)
Convert the given array of characters to lower case

This modifies the original array! It is a one-way function, once it has been run you can never go back to what you had so be very careful if you ever call it on a string!

Parameters:
ch - The character array
offset - The offset into the character array
len - The number of characters to convert

toUpperCase

public char toUpperCase(char ch)
Convert a block of characters to upper case

Parameters:
ch - The value
Returns:
the upper case value

toUpperCase

public void toUpperCase(char[] ch,
                        int offset,
                        int len)
Convert the given array of characters to upper case This modifies the original array! It is a one-way function, once it has been run you can never go back to what you had so be very careful if you ever call it on a string!

Parameters:
ch - The character array
offset - The offset into the character array
len - The number of characters to convert

trimWhiteSpace

public char[] trimWhiteSpace(char[] c,
                             int o,
                             int l)
Trim white space off the ends of the string. If the original characetr array had no trimmable whitespace then the original character array is returned

Parameters:
c - The character array
o - The offset into it
l - The length
Returns:
a newly allocated array without the spaces at either end

upperCaseCopy

public char[] upperCaseCopy(char[] c,
                            int o,
                            int l)
Copy a char array into a new array, converting all chars to upper case

Parameters:
c - The character array
o - The offset into it
l - The length
Returns:
a new array which is an upper case copy of 'c'

writeCharacter

public void writeCharacter(char c,
                           OutputStream os)
                    throws IOException
Write a single character to the specified OutputStream

Parameters:
c - The character
os - The output stream
Throws:
IOException - if there is an IO error

writeCharacters

public void writeCharacters(char[] c,
                            OutputStream os)
                     throws IOException
Sends an array of characters directly to a specified OutputStream

Parameters:
c - The character array
os - The output stream
Throws:
IOException - if there is an IO error

writeCharacters

public void writeCharacters(char[] c,
                            int off,
                            int len,
                            OutputStream os)
                     throws IOException
Sends an array of characters directly to a specified OutputStream

Parameters:
c - The character array
off - The offset
len - The number of characters to write
os - The output stream
Throws:
IOException - if there is an IO error

DCT Lightfoot v3 API specification

DCT Lightfoot v3 API specification