DateFormatSymbolspublic class DateFormatSymbols extends Object implements SerializableResourceDateFormatSymbols is class for encapsulating localizable
date/time formatting data, such as the names of the months, the names of the
days of the week, and the time zone data. DateTimeFormat uses
DateFormatSymbols to encapsulate this information.
DateFormatSymbols is typicaly obtained from
javax.microedition.ResourceManager
respectively from DevResourceManager.getDateFormatSymbols()
from resource file for given locale.
Typically you shouldn't use DateFormatSymbols directly. Rather,
you are encouraged to create a date/time formatter with the
DateTimeFormat class's factory methods:
getInstance(int style, String locale)
These methods automatically create a DateFormatSymbols for the
formatter so that you don't have to. All fields are public intentionaly. |
Fields Summary |
---|
public String[] | eraseras. | public String[] | monthsmonth names. | public String[] | shortMonthsshort month names. | public String[] | weekDaysday in week names. | public String[] | shortWeekDaysshort day in week names. | public String[] | ampmsampms. | public String[] | patternslocalized patterns 6 possible styles as they are defined in {@link
DateTimeFormat}. | public String | localelocale of this symbols. |
Constructors Summary |
---|
public DateFormatSymbols()Create new DateFormatSymbol uninitialized.
|
Methods Summary |
---|
public java.lang.Object | clone()The method clones the resource.
DateFormatSymbols newDfs = null;
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
write(baos);
baos.close();
byte[] buffer = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(buffer);
newDfs = new DateFormatSymbols();
newDfs.read(bais);
} catch (IOException ioe) {
// cannot clone resource
}
return newDfs;
| public void | read(java.io.InputStream in)Read DateFormatSymbols object from input stream.
DataInputStream dis = new DataInputStream(in);
readStrings(eras, dis);
readStrings(months, dis);
readStrings(shortMonths, dis);
readStrings(weekDays, dis);
readStrings(shortWeekDays, dis);
readStrings(ampms, dis);
readStrings(patterns, dis);
locale = dis.readUTF();
| protected void | readStrings(java.lang.String[] array, java.io.DataInputStream dis)Read strings helper. Reads string array.
for (int i = 0; i < array.length; i++) {
array[i] = dis.readUTF();
}
| public void | write(java.io.OutputStream out)Serialize DateFormatSymbols object into output stream.
DataOutputStream dous = new DataOutputStream(out);
writeStrings(eras, dous);
writeStrings(months, dous);
writeStrings(shortMonths, dous);
writeStrings(weekDays, dous);
writeStrings(shortWeekDays, dous);
writeStrings(ampms, dous);
writeStrings(patterns, dous);
dous.writeUTF(locale);
dous.flush();
| protected void | writeStrings(java.lang.String[] array, java.io.DataOutputStream dous)Write array helper. Writes string array.
for (int i = 0; i < array.length; i++) {
dous.writeUTF(array[i]);
}
|
|