Java Doc for DateFormatSymbols.java in  » 6.0-JDK-Core » text » java » text » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » text » java.text 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.text.DateFormatSymbols

DateFormatSymbols
public class DateFormatSymbols implements Serializable,Cloneable(Code)
DateFormatSymbols is a public 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. DateFormat and SimpleDateFormat both use DateFormatSymbols to encapsulate this information.

Typically you shouldn't use DateFormatSymbols directly. Rather, you are encouraged to create a date-time formatter with the DateFormat class's factory methods: getTimeInstance, getDateInstance, or getDateTimeInstance. These methods automatically create a DateFormatSymbols for the formatter so that you don't have to. After the formatter is created, you may modify its format pattern using the setPattern method. For more information about creating formatters using DateFormat's factory methods, see DateFormat .

If you decide to create a date-time formatter with a specific format pattern for a specific locale, you can do so with:

 new SimpleDateFormat(aPattern, DateFormatSymbols.getInstance(aLocale)).
 

DateFormatSymbols objects are cloneable. When you obtain a DateFormatSymbols object, feel free to modify the date-time formatting data. For instance, you can replace the localized date-time format pattern characters with the ones that you feel easy to remember. Or you can change the representative cities to your favorite ones.

New DateFormatSymbols subclasses may be added to support SimpleDateFormat for date-time formatting for additional locales.
See Also:   DateFormat
See Also:   SimpleDateFormat
See Also:   java.util.SimpleTimeZone
version:
   1.54 05/05/07
author:
   Chen-Lieh Huang



Field Summary
 Stringampms
     AM and PM strings.
 Stringeras
     Era strings.
transient  booleanisZoneStringsSet
     Indicates that zoneStrings is set externally with setZoneStrings() method.
 StringlocalPatternChars
     Localized date-time pattern characters.
 Localelocale
     The locale which is used for initializing this DateFormatSymbols object.
final static  intmillisPerHour
     Useful constant for defining time zone offsets.
 Stringmonths
     Month strings.
final static  StringpatternChars
     Unlocalized date-time pattern characters.
final static  longserialVersionUID
    
 StringshortMonths
     Short month strings.
 StringshortWeekdays
     Short weekday strings.
 Stringweekdays
     Weekday strings.
 StringzoneStrings
     Localized names of time zones in this locale.

Constructor Summary
public  DateFormatSymbols()
     Construct a DateFormatSymbols object by loading format data from resources for the default locale.
public  DateFormatSymbols(Locale locale)
     Construct a DateFormatSymbols object by loading format data from resources for the given locale.

Method Summary
public  Objectclone()
    
public  booleanequals(Object obj)
    
public  String[]getAmPmStrings()
     Gets ampm strings.
public static  Locale[]getAvailableLocales()
     Returns an array of all locales for which the getInstance methods of this class can return localized instances. The returned array represents the union of locales supported by the Java runtime and by installed java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider implementations.
public  String[]getEras()
     Gets era strings.
final public static  DateFormatSymbolsgetInstance()
     Gets the DateFormatSymbols instance for the default locale.
final public static  DateFormatSymbolsgetInstance(Locale locale)
     Gets the DateFormatSymbols instance for the specified locale.
public  StringgetLocalPatternChars()
     Gets localized date-time pattern characters.
public  String[]getMonths()
     Gets month strings.
public  String[]getShortMonths()
     Gets short month strings.
public  String[]getShortWeekdays()
     Gets short weekday strings.
public  String[]getWeekdays()
     Gets weekday strings.
final  intgetZoneIndex(String ID)
     Package private: used by SimpleDateFormat Gets the index for the given time zone ID to obtain the time zone strings for formatting.
public  String[][]getZoneStrings()
     Gets time zone strings.
final  String[][]getZoneStringsWrapper()
     Wrapper method to the getZoneStrings(), which is called from inside the java.text package and not to mutate the returned arrays, so that it does not need to create a defensive copy.
public  inthashCode()
     Override hashCode.
public  voidsetAmPmStrings(String[] newAmpms)
     Sets ampm strings.
public  voidsetEras(String[] newEras)
     Sets era strings.
public  voidsetLocalPatternChars(String newLocalPatternChars)
     Sets localized date-time pattern characters.
public  voidsetMonths(String[] newMonths)
     Sets month strings.
public  voidsetShortMonths(String[] newShortMonths)
     Sets short month strings.
public  voidsetShortWeekdays(String[] newShortWeekdays)
     Sets short weekday strings.
public  voidsetWeekdays(String[] newWeekdays)
     Sets weekday strings.
public  voidsetZoneStrings(String[][] newZoneStrings)
     Sets time zone strings.

Field Detail
ampms
String ampms(Code)
AM and PM strings. For example: "AM" and "PM". An array of 2 strings, indexed by Calendar.AM and Calendar.PM.



eras
String eras(Code)
Era strings. For example: "AD" and "BC". An array of 2 strings, indexed by Calendar.BC and Calendar.AD.



isZoneStringsSet
transient boolean isZoneStringsSet(Code)
Indicates that zoneStrings is set externally with setZoneStrings() method.



localPatternChars
String localPatternChars(Code)
Localized date-time pattern characters. For example, a locale may wish to use 'u' rather than 'y' to represent years in its date format pattern strings. This string must be exactly 18 characters long, with the index of the characters described by DateFormat.ERA_FIELD, DateFormat.YEAR_FIELD, etc. Thus, if the string were "Xz...", then localized patterns would use 'X' for era and 'z' for year.



locale
Locale locale(Code)
The locale which is used for initializing this DateFormatSymbols object.
since:
   1.6



millisPerHour
final static int millisPerHour(Code)
Useful constant for defining time zone offsets.



months
String months(Code)
Month strings. For example: "January", "February", etc. An array of 13 strings (some calendars have 13 months), indexed by Calendar.JANUARY, Calendar.FEBRUARY, etc.



patternChars
final static String patternChars(Code)
Unlocalized date-time pattern characters. For example: 'y', 'd', etc. All locales use the same these unlocalized pattern characters.



serialVersionUID
final static long serialVersionUID(Code)



shortMonths
String shortMonths(Code)
Short month strings. For example: "Jan", "Feb", etc. An array of 13 strings (some calendars have 13 months), indexed by Calendar.JANUARY, Calendar.FEBRUARY, etc.



shortWeekdays
String shortWeekdays(Code)
Short weekday strings. For example: "Sun", "Mon", etc. An array of 8 strings, indexed by Calendar.SUNDAY, Calendar.MONDAY, etc. The element shortWeekdays[0] is ignored.



weekdays
String weekdays(Code)
Weekday strings. For example: "Sunday", "Monday", etc. An array of 8 strings, indexed by Calendar.SUNDAY, Calendar.MONDAY, etc. The element weekdays[0] is ignored.



zoneStrings
String zoneStrings(Code)
Localized names of time zones in this locale. This is a two-dimensional array of strings of size n by m, where m is at least 5. Each of the n rows is an entry containing the localized names for a single TimeZone. Each such row contains (with i ranging from 0..n-1):
  • zoneStrings[i][0] - time zone ID
  • zoneStrings[i][1] - long name of zone in standard time
  • zoneStrings[i][2] - short name of zone in standard time
  • zoneStrings[i][3] - long name of zone in daylight saving time
  • zoneStrings[i][4] - short name of zone in daylight saving time
The zone ID is not localized; it's one of the valid IDs of the java.util.TimeZone TimeZone class that are not custom IDs. All other entries are localized names.
See Also:   java.util.TimeZone




Constructor Detail
DateFormatSymbols
public DateFormatSymbols()(Code)
Construct a DateFormatSymbols object by loading format data from resources for the default locale. This constructor can only construct instances for the locales supported by the Java runtime environment, not for those supported by installed java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider implementations. For full locale coverage, use the DateFormatSymbols.getInstance(Locale) getInstance method.
See Also:   DateFormatSymbols.getInstance()
exception:
  java.util.MissingResourceException - if the resources for the default locale cannot befound or cannot be loaded.



DateFormatSymbols
public DateFormatSymbols(Locale locale)(Code)
Construct a DateFormatSymbols object by loading format data from resources for the given locale. This constructor can only construct instances for the locales supported by the Java runtime environment, not for those supported by installed java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider implementations. For full locale coverage, use the DateFormatSymbols.getInstance(Locale) getInstance method.
See Also:   DateFormatSymbols.getInstance(Locale)
exception:
  java.util.MissingResourceException - if the resources for the specified locale cannot befound or cannot be loaded.




Method Detail
clone
public Object clone()(Code)
Overrides Cloneable



equals
public boolean equals(Object obj)(Code)
Override equals



getAmPmStrings
public String[] getAmPmStrings()(Code)
Gets ampm strings. For example: "AM" and "PM". the ampm strings.



getAvailableLocales
public static Locale[] getAvailableLocales()(Code)
Returns an array of all locales for which the getInstance methods of this class can return localized instances. The returned array represents the union of locales supported by the Java runtime and by installed java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider implementations. It must contain at least a Locale instance equal to java.util.Locale.US Locale.US . An array of locales for which localizedDateFormatSymbols instances are available.
since:
   1.6



getEras
public String[] getEras()(Code)
Gets era strings. For example: "AD" and "BC". the era strings.



getInstance
final public static DateFormatSymbols getInstance()(Code)
Gets the DateFormatSymbols instance for the default locale. This method provides access to DateFormatSymbols instances for locales supported by the Java runtime itself as well as for those supported by installed java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider implementations. a DateFormatSymbols instance.
since:
   1.6



getInstance
final public static DateFormatSymbols getInstance(Locale locale)(Code)
Gets the DateFormatSymbols instance for the specified locale. This method provides access to DateFormatSymbols instances for locales supported by the Java runtime itself as well as for those supported by installed java.text.spi.DateFormatSymbolsProvider DateFormatSymbolsProvider implementations.
Parameters:
  locale - the given locale. a DateFormatSymbols instance.
exception:
  NullPointerException - if locale is null
since:
   1.6



getLocalPatternChars
public String getLocalPatternChars()(Code)
Gets localized date-time pattern characters. For example: 'u', 't', etc. the localized date-time pattern characters.



getMonths
public String[] getMonths()(Code)
Gets month strings. For example: "January", "February", etc. the month strings.



getShortMonths
public String[] getShortMonths()(Code)
Gets short month strings. For example: "Jan", "Feb", etc. the short month strings.



getShortWeekdays
public String[] getShortWeekdays()(Code)
Gets short weekday strings. For example: "Sun", "Mon", etc. the short weekday strings. Use Calendar.SUNDAY,Calendar.MONDAY, etc. to index the result array.



getWeekdays
public String[] getWeekdays()(Code)
Gets weekday strings. For example: "Sunday", "Monday", etc. the weekday strings. Use Calendar.SUNDAY,Calendar.MONDAY, etc. to index the result array.



getZoneIndex
final int getZoneIndex(String ID)(Code)
Package private: used by SimpleDateFormat Gets the index for the given time zone ID to obtain the time zone strings for formatting. The time zone ID is just for programmatic lookup. NOT LOCALIZED!!!
Parameters:
  ID - the given time zone ID. the index of the given time zone ID. Returns -1 ifthe given time zone ID can't be located in the DateFormatSymbols object.
See Also:   java.util.SimpleTimeZone



getZoneStrings
public String[][] getZoneStrings()(Code)
Gets time zone strings. Use of this method is discouraged; use java.util.TimeZone.getDisplayName TimeZone.getDisplayName() instead.

The value returned is a two-dimensional array of strings of size n by m, where m is at least 5. Each of the n rows is an entry containing the localized names for a single TimeZone. Each such row contains (with i ranging from 0..n-1):

  • zoneStrings[i][0] - time zone ID
  • zoneStrings[i][1] - long name of zone in standard time
  • zoneStrings[i][2] - short name of zone in standard time
  • zoneStrings[i][3] - long name of zone in daylight saving time
  • zoneStrings[i][4] - short name of zone in daylight saving time
The zone ID is not localized; it's one of the valid IDs of the java.util.TimeZone TimeZone class that are not custom IDs. All other entries are localized names. If a zone does not implement daylight saving time, the daylight saving time names should not be used.

If DateFormatSymbols.setZoneStrings(String[][]) setZoneStrings has been called on this DateFormatSymbols instance, then the strings provided by that call are returned. Otherwise, the returned array contains names provided by the Java runtime and by installed java.util.spi.TimeZoneNameProvider TimeZoneNameProvider implementations. the time zone strings.
See Also:   DateFormatSymbols.setZoneStrings(String[][])




getZoneStringsWrapper
final String[][] getZoneStringsWrapper()(Code)
Wrapper method to the getZoneStrings(), which is called from inside the java.text package and not to mutate the returned arrays, so that it does not need to create a defensive copy.



hashCode
public int hashCode()(Code)
Override hashCode. Generates a hash code for the DateFormatSymbols object.



setAmPmStrings
public void setAmPmStrings(String[] newAmpms)(Code)
Sets ampm strings. For example: "AM" and "PM".
Parameters:
  newAmpms - the new ampm strings.



setEras
public void setEras(String[] newEras)(Code)
Sets era strings. For example: "AD" and "BC".
Parameters:
  newEras - the new era strings.



setLocalPatternChars
public void setLocalPatternChars(String newLocalPatternChars)(Code)
Sets localized date-time pattern characters. For example: 'u', 't', etc.
Parameters:
  newLocalPatternChars - the new localized date-timepattern characters.



setMonths
public void setMonths(String[] newMonths)(Code)
Sets month strings. For example: "January", "February", etc.
Parameters:
  newMonths - the new month strings.



setShortMonths
public void setShortMonths(String[] newShortMonths)(Code)
Sets short month strings. For example: "Jan", "Feb", etc.
Parameters:
  newShortMonths - the new short month strings.



setShortWeekdays
public void setShortWeekdays(String[] newShortWeekdays)(Code)
Sets short weekday strings. For example: "Sun", "Mon", etc.
Parameters:
  newShortWeekdays - the new short weekday strings. The array shouldbe indexed by Calendar.SUNDAY,Calendar.MONDAY, etc.



setWeekdays
public void setWeekdays(String[] newWeekdays)(Code)
Sets weekday strings. For example: "Sunday", "Monday", etc.
Parameters:
  newWeekdays - the new weekday strings. The array shouldbe indexed by Calendar.SUNDAY,Calendar.MONDAY, etc.



setZoneStrings
public void setZoneStrings(String[][] newZoneStrings)(Code)
Sets time zone strings. The argument must be a two-dimensional array of strings of size n by m, where m is at least 5. Each of the n rows is an entry containing the localized names for a single TimeZone. Each such row contains (with i ranging from 0..n-1):
  • zoneStrings[i][0] - time zone ID
  • zoneStrings[i][1] - long name of zone in standard time
  • zoneStrings[i][2] - short name of zone in standard time
  • zoneStrings[i][3] - long name of zone in daylight saving time
  • zoneStrings[i][4] - short name of zone in daylight saving time
The zone ID is not localized; it's one of the valid IDs of the java.util.TimeZone TimeZone class that are not custom IDs. All other entries are localized names.
Parameters:
  newZoneStrings - the new time zone strings.
exception:
  IllegalArgumentException - if the length of any row innewZoneStrings is less than 5
exception:
  NullPointerException - if newZoneStrings is null
See Also:   DateFormatSymbols.getZoneStrings()



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.