Java Doc for ZoneInfoFile.java in  » 6.0-JDK-Modules » j2me » sun » util » calendar » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » sun.util.calendar 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   sun.util.calendar.ZoneInfoFile

ZoneInfoFile
public class ZoneInfoFile (Code)
ZoneInfoFile reads Zone information files in the <java.home>/lib/zi directory and provides time zone information in the form of a ZoneInfo object. Also, it reads the ZoneInfoMappings file to obtain time zone IDs information that is used by the ZoneInfo class. The directory layout and data file formats are as follows.

Directory layout

All zone data files and ZoneInfoMappings are put under the <java.home>/lib/zi directory. A path name for a given time zone ID is a concatenation of <java.home>/lib/zi/ and the time zone ID. (The file separator is replaced with the platform dependent value. e.g., '\' for Win32.) An example layout will look like as follows.

 <java.home>/lib/zi/Africa/Addis_Ababa
 /Africa/Dakar
 /America/Los_Angeles
 /Asia/Singapore
 /EET
 /Europe/Oslo
 /GMT
 /Pacific/Galapagos
 ...
 /ZoneInfoMappings
 
A zone data file has specific information of each zone. ZoneInfoMappings has global information of zone IDs so that the information can be obtained without instantiating all time zones.

File format

Two binary-file formats based on a simple Tag-Length-Value format are used to describe TimeZone information. The generic format of a data file is:

 DataFile {
 u1              magic[7];
 u1              version;
 data_item       data[];
 }
 
where magic is a magic number identifying a file format, version is the format version number, and data is one or more data_items. The data_item structure is:
 data_item {
 u1              tag;
 u2              length;
 u1              value[length];
 }
 
where tag indicates the data type of the item, length is a byte count of the following value that is the content of item data.

All data is stored in the big-endian order. There is no boundary alignment between date items.

1. ZoneInfo data file

Each ZoneInfo data file consists of the following members.

 ZoneInfoDataFile {
 u1              magic[7];
 u1              version;
 SET OF1 {
 transition            transitions2;
 offset_table          offsets2;
 simpletimezone        stzparams2;
 raw_offset            rawoffset;
 dstsaving             dst;
 checksum              crc32;
 gmtoffsetwillchange   gmtflag2;
 }
 }
 1: an unordered collection of zero or one occurrences of each item
 2: optional item
 
magic is a byte-string constant identifying the ZoneInfo data file. This field must be "javazi\0" defined as ZoneInfoFile.JAVAZI_LABEL .

version is the version number of the file format. This will be used for compatibility check. This field must be 0x01 in this version.

transition, offset_table and simpletimezone have information of time transition from the past to the future. Therefore, these structures don't exist if the zone didn't change zone names and haven't applied DST in the past, and haven't planned to apply it. (e.g. Asia/Tokyo zone)

raw_offset, dstsaving and checksum exist in every zoneinfo file. They are used by TimeZone.class indirectly.

1.1 transition structure

 transition {
 u1      tag;              // 0x04 : constant
 u2      length;           // byte length of whole values
 s8      value[length/8];  // transitions in `long'
 }
 
See ZoneInfo.transitions ZoneInfo.transitions about the value.

1.2 offset_table structure

 offset_table {
 u1      tag;              // 0x05 : constant
 u2      length;           // byte length of whole values
 s4      value[length/4];  // offset values in `int'
 }
 

1.3 simpletimezone structure

See ZoneInfo.simpleTimeZoneParams ZoneInfo.simpleTimeZoneParams about the value.

 simpletimezone {
 u1      tag;              // 0x06 : constant
 u2      length;           // byte length of whole values
 s4      value[length/4];  // SimpleTimeZone parameters
 }
 
See ZoneInfo.offsets ZoneInfo.offsets about the value.

1.4 raw_offset structure

 raw_offset {
 u1	tag;              // 0x01 : constant
 u2	length;           // must be 4.
 s4	value;            // raw GMT offset [millisecond]
 }
 
See ZoneInfo.rawOffset ZoneInfo.rawOffset about the value.

1.5 dstsaving structure

Value has dstSaving in seconds.

 dstsaving {
 u1	tag;              // 0x02 : constant
 u2	length;           // must be 2.
 s2	value;            // DST save value [second]
 }
 
See ZoneInfo.dstSavings ZoneInfo.dstSavings about value.

1.6 checksum structure

 checksum {
 u1	tag;              // 0x03 : constant
 u2	length;           // must be 4.
 s4	value;            // CRC32 value of transitions
 }
 
See ZoneInfo.checksum ZoneInfo.checksum .

1.7 gmtoffsetwillchange structure

This record has a flag value for ZoneInfo.rawOffsetWillChange . If this record is not present in a zoneinfo file, 0 is assumed for the value.

 gmtoffsetwillchange {
 u1      tag;             // 0x07 : constant
 u2      length;          // must be 1.
 u1      value;           // 1: if the GMT raw offset will change
 // in the future, 0, otherwise.
 }
 

2. ZoneInfoMappings file

The ZoneInfoMappings file consists of the following members.

 ZoneInfoMappings {
 u1      magic[7];
 u1      version;
 SET OF {
 versionName                   version;
 zone_id_table                 zoneIDs;
 raw_offset_table              rawoffsets;
 raw_offset_index_table        rawoffsetindices;
 alias_table                   aliases;
 }
 }
 
magic is a byte-string constant which has the file type. This field must be "javazm\0" defined as ZoneInfoFile.JAVAZM_LABEL .

version is the version number of this file format. This will be used for compatibility check. This field must be 0x01 in this version.

versionName shows which version of Olson's data has been used to generate this ZoneInfoMappings. (e.g. tzdata2000g)
This field is for trouble-shooting and isn't usually used in runtime.

zone_id_tableraw_offset_index_table and alias_table are general information of supported zones.

2.1 zone_id_table structure


 zone_id_table {
 u1      tag;              // 0x40 : constant
 u2      length;           // byte length of whole values
 u2      zone_id_count;
 zone_id value[zone_id_count];
 }
 zone_id {
 u1      byte_length;      // byte length of id
 u1      id[byte_length];  // zone name string
 }
 

2.2 raw_offset_table structure


 raw_offset_table {
 u1      tag;              // 0x41 : constant
 u2      length;           // byte length of whole values
 s4      value[length/4];  // raw GMT offset in milliseconds
 }
 

2.3 raw_offset_index_table structure


 raw_offset_index_table {
 u1      tag;              // 0x42 : constant
 u2      length;           // byte length of whole values
 u1      value[length];
 }
 

2.4 alias_table structure


 alias_table {
 u1      tag;              // 0x43 : constant
 u2      length;           // byte length of whole values
 u2      nentries;         // number of id-pairs
 id_pair value[nentries];
 }
 id_pair {
 zone_id aliasname;
 zone_id ID;
 }
 

2.5 versionName structure


 versionName {
 u1      tag;              // 0x44 : constant
 u2      length;           // byte length of whole values
 u1      value[length];
 }
 

since:
   1.4


Field Summary
final public static  byte[]JAVAZI_LABEL
     The magic number for the ZoneInfo data file format.
final public static  byteJAVAZI_VERSION
     The ZoneInfo data file formation version number.
final public static  StringJAVAZM_FILE_NAME
     The ZoneInfoMappings file name.
final public static  byte[]JAVAZM_LABEL
     The magic number for the ZoneInfoMappings file format.
final public static  byteJAVAZM_VERSION
     The ZoneInfoMappings file format version number.
final public static  byteTAG_CRC32
     Checksum data item tag.
final public static  byteTAG_GMTOffsetWillChange
     Raw GMT offset will change in the future.
final public static  byteTAG_LastDSTSaving
     Known last Daylight Saving Time save value data item tag.
final public static  byteTAG_Offset
     Offset table data item tag.
final public static  byteTAG_RawOffset
     Raw offset data item tag.
final public static  byteTAG_RawOffsetIndices
     Indices to the raw GMT offset table data item tag.
final public static  byteTAG_RawOffsets
     Raw GMT offsets table data item tag.
final public static  byteTAG_SimpleTimeZone
     SimpleTimeZone parameters data item tag.
final public static  byteTAG_TZDataVersion
     Olson's public zone information version tag.
final public static  byteTAG_Transition
     Transition data item tag.
final public static  byteTAG_ZoneAliases
     Time zone aliases table data item tag.
final public static  byteTAG_ZoneIDs
     Time zone IDs data item tag.


Method Summary
public static  ZoneInfogetCustomTimeZone(String originalId, int gmtOffset)
     Gets a ZoneInfo with the given GMT offset.
public static  StringgetFileName(String ID)
     Converts the given time zone ID to a platform dependent path name.
static  byte[]getRawOffsetIndices()
    
static  int[]getRawOffsets()
    
static  HashMapgetZoneAliases()
    
static  String[]getZoneIDs()
    
public static synchronized  ZoneInfogetZoneInfo(String ID)
    

Field Detail
JAVAZI_LABEL
final public static byte[] JAVAZI_LABEL(Code)
The magic number for the ZoneInfo data file format.



JAVAZI_VERSION
final public static byte JAVAZI_VERSION(Code)
The ZoneInfo data file formation version number.



JAVAZM_FILE_NAME
final public static String JAVAZM_FILE_NAME(Code)
The ZoneInfoMappings file name.



JAVAZM_LABEL
final public static byte[] JAVAZM_LABEL(Code)
The magic number for the ZoneInfoMappings file format.



JAVAZM_VERSION
final public static byte JAVAZM_VERSION(Code)
The ZoneInfoMappings file format version number.



TAG_CRC32
final public static byte TAG_CRC32(Code)
Checksum data item tag.



TAG_GMTOffsetWillChange
final public static byte TAG_GMTOffsetWillChange(Code)
Raw GMT offset will change in the future.



TAG_LastDSTSaving
final public static byte TAG_LastDSTSaving(Code)
Known last Daylight Saving Time save value data item tag.



TAG_Offset
final public static byte TAG_Offset(Code)
Offset table data item tag.



TAG_RawOffset
final public static byte TAG_RawOffset(Code)
Raw offset data item tag.



TAG_RawOffsetIndices
final public static byte TAG_RawOffsetIndices(Code)
Indices to the raw GMT offset table data item tag.



TAG_RawOffsets
final public static byte TAG_RawOffsets(Code)
Raw GMT offsets table data item tag.



TAG_SimpleTimeZone
final public static byte TAG_SimpleTimeZone(Code)
SimpleTimeZone parameters data item tag.



TAG_TZDataVersion
final public static byte TAG_TZDataVersion(Code)
Olson's public zone information version tag.



TAG_Transition
final public static byte TAG_Transition(Code)
Transition data item tag.



TAG_ZoneAliases
final public static byte TAG_ZoneAliases(Code)
Time zone aliases table data item tag.



TAG_ZoneIDs
final public static byte TAG_ZoneIDs(Code)
Time zone IDs data item tag.





Method Detail
getCustomTimeZone
public static ZoneInfo getCustomTimeZone(String originalId, int gmtOffset)(Code)
Gets a ZoneInfo with the given GMT offset. The object has its ID in the format of GMT{+|-}hh:mm.
Parameters:
  originalId - the given custom id (before normalized such as "GMT+9")
Parameters:
  gmtOffset - GMT offset in minutes a ZoneInfo constructed with the given GMT offset



getFileName
public static String getFileName(String ID)(Code)
Converts the given time zone ID to a platform dependent path name. For example, "America/Los_Angeles" is converted to "America\Los_Angeles" on Win32. a modified ID replacing '/' with java.io.File.separatorChar File.separatorChar if needed.



getRawOffsetIndices
static byte[] getRawOffsetIndices()(Code)



getRawOffsets
static int[] getRawOffsets()(Code)



getZoneAliases
static HashMap getZoneAliases()(Code)
an alias table in HashMap where a key is an alias ID(e.g., "PST") and its value is a real time zone ID (e.g.,"America/Los_Angeles").



getZoneIDs
static String[] getZoneIDs()(Code)



getZoneInfo
public static synchronized ZoneInfo getZoneInfo(String ID)(Code)
a ZoneInfo instance created for the specified ID ornull if there is no time zone data file found for the specifiedID.



Methods inherited from java.lang.Object
public boolean equals(Object obj)(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.