CldcUtilspublic class CldcUtils extends Utils This class implements utility methods used in the
com.sun.j2me.payment package. |
Fields Summary |
---|
public static final int | PAYMENT_ID_OFFSETThe offset value between Utils and ResourceConstants resource keys. |
Constructors Summary |
---|
public CldcUtils()Creates a new instance of CldcUtils .
|
Methods Summary |
---|
public java.lang.String | formatISODate(long date)Converts the given date to the string formatted according to the
ISO 8601 standard.
TimeZone gmtTimeZone = TimeZone.getTimeZone("GMT");
Calendar gmtCalendar = Calendar.getInstance(gmtTimeZone);
gmtCalendar.setTime(new Date(date));
StringBuffer buffer = new StringBuffer();
char[] temp = new char[4];
formatNumber(temp, gmtCalendar.get(Calendar.YEAR), 4);
buffer.append(temp, 0, 4);
buffer.append('-");
formatNumber(temp, gmtCalendar.get(Calendar.MONTH) + 1, 2);
buffer.append(temp, 0, 2);
buffer.append('-");
formatNumber(temp, gmtCalendar.get(Calendar.DAY_OF_MONTH), 2);
buffer.append(temp, 0, 2);
buffer.append(' ");
formatNumber(temp, gmtCalendar.get(Calendar.HOUR_OF_DAY), 2);
buffer.append(temp, 0, 2);
buffer.append(':");
formatNumber(temp, gmtCalendar.get(Calendar.MINUTE), 2);
buffer.append(temp, 0, 2);
buffer.append(':");
formatNumber(temp, gmtCalendar.get(Calendar.SECOND), 2);
buffer.append(temp, 0, 2);
buffer.append('Z");
return buffer.toString();
| private void | formatNumber(char[] dest, int number, int digits)
int index = digits;
while (index > 0) {
dest[--index] = (char)((number % 10) + '0");
number = number / 10;
}
| public java.lang.String | getString(int key)Returns a resource string for the given key.
if (key >= PAYMENT_ID_OFFSET) {
key -= PAYMENT_ID_OFFSET;
}
return Resource.getString(key);
| public java.lang.String | getString(int key, java.lang.String[] values)Returns a modified resource string for the given key. It replaces any
occurence of %1, %2, ... in the original resource string with the first,
second, ... string from values .
if (key >= PAYMENT_ID_OFFSET) {
key -= PAYMENT_ID_OFFSET;
}
return Resource.getString(key, values);
| public com.sun.midp.util.Properties | loadProperties(java.io.InputStream is, java.lang.String charset)Parses properties from the given input stream and returns them as an
instance of the Properties class. The charset
parameter contains the actual character encoding of the input stream.
JadProperties props = new JadProperties();
props.load(is, charset);
return props;
| public long | parseISODate(java.lang.String date)Parses a date string according to the ISO 8601 standard.
return DateParser.parseISO(date);
|
|