Java Doc for DateTimeZoneBuilder.java in  » Development » Joda-Time » org » joda » time » tz » 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 » Development » Joda Time » org.joda.time.tz 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.joda.time.tz.DateTimeZoneBuilder

DateTimeZoneBuilder
public class DateTimeZoneBuilder (Code)
DateTimeZoneBuilder allows complex DateTimeZones to be constructed. Since creating a new DateTimeZone this way is a relatively expensive operation, built zones can be written to a file. Reading back the encoded data is a quick operation.

DateTimeZoneBuilder itself is mutable and not thread-safe, but the DateTimeZone objects that it builds are thread-safe and immutable.

It is intended that ZoneInfoCompiler be used to read time zone data files, indirectly calling DateTimeZoneBuilder. The following complex example defines the America/Los_Angeles time zone, with all historical transitions:

 DateTimeZone America_Los_Angeles = new DateTimeZoneBuilder()
 .addCutover(-2147483648, 'w', 1, 1, 0, false, 0)
 .setStandardOffset(-28378000)
 .setFixedSavings("LMT", 0)
 .addCutover(1883, 'w', 11, 18, 0, false, 43200000)
 .setStandardOffset(-28800000)
 .addRecurringSavings("PDT", 3600000, 1918, 1919, 'w',  3, -1, 7, false, 7200000)
 .addRecurringSavings("PST",       0, 1918, 1919, 'w', 10, -1, 7, false, 7200000)
 .addRecurringSavings("PWT", 3600000, 1942, 1942, 'w',  2,  9, 0, false, 7200000)
 .addRecurringSavings("PPT", 3600000, 1945, 1945, 'u',  8, 14, 0, false, 82800000)
 .addRecurringSavings("PST",       0, 1945, 1945, 'w',  9, 30, 0, false, 7200000)
 .addRecurringSavings("PDT", 3600000, 1948, 1948, 'w',  3, 14, 0, false, 7200000)
 .addRecurringSavings("PST",       0, 1949, 1949, 'w',  1,  1, 0, false, 7200000)
 .addRecurringSavings("PDT", 3600000, 1950, 1966, 'w',  4, -1, 7, false, 7200000)
 .addRecurringSavings("PST",       0, 1950, 1961, 'w',  9, -1, 7, false, 7200000)
 .addRecurringSavings("PST",       0, 1962, 1966, 'w', 10, -1, 7, false, 7200000)
 .addRecurringSavings("PST",       0, 1967, 2147483647, 'w', 10, -1, 7, false, 7200000)
 .addRecurringSavings("PDT", 3600000, 1967, 1973, 'w', 4, -1,  7, false, 7200000)
 .addRecurringSavings("PDT", 3600000, 1974, 1974, 'w', 1,  6,  0, false, 7200000)
 .addRecurringSavings("PDT", 3600000, 1975, 1975, 'w', 2, 23,  0, false, 7200000)
 .addRecurringSavings("PDT", 3600000, 1976, 1986, 'w', 4, -1,  7, false, 7200000)
 .addRecurringSavings("PDT", 3600000, 1987, 2147483647, 'w', 4, 1, 7, true, 7200000)
 .toDateTimeZone("America/Los_Angeles");
 

author:
   Brian S O'Neill
See Also:   ZoneInfoCompiler
See Also:   ZoneInfoProvider
since:
   1.0



Constructor Summary
public  DateTimeZoneBuilder()
    

Method Summary
public  DateTimeZoneBuilderaddCutover(int year, char mode, int monthOfYear, int dayOfMonth, int dayOfWeek, boolean advanceDayOfWeek, int millisOfDay)
     Adds a cutover for added rules.
public  DateTimeZoneBuilderaddRecurringSavings(String nameKey, int saveMillis, int fromYear, int toYear, char mode, int monthOfYear, int dayOfMonth, int dayOfWeek, boolean advanceDayOfWeek, int millisOfDay)
     Add a recurring daylight saving time rule.
Parameters:
  nameKey - name key of new rule
Parameters:
  saveMillis - milliseconds to add to standard offset
Parameters:
  fromYear - First year that rule is in effect.
public static  DateTimeZonereadFrom(InputStream in, String id)
     Decodes a built DateTimeZone from the given stream, as encoded by writeTo.
public static  DateTimeZonereadFrom(DataInput in, String id)
     Decodes a built DateTimeZone from the given stream, as encoded by writeTo.
static  longreadMillis(DataInput in)
     Reads encoding generated by writeMillis.
public  DateTimeZoneBuildersetFixedSavings(String nameKey, int saveMillis)
     Set a fixed savings rule at the cutover.
public  DateTimeZoneBuildersetStandardOffset(int standardOffset)
     Sets the standard offset to use for newly added rules until the next cutover is added.
public  DateTimeZonetoDateTimeZone(String id, boolean outputID)
     Processes all the rules and builds a DateTimeZone.
static  voidwriteMillis(DataOutput out, long millis)
     Millisecond encoding formats: upper two bits units field length approximate range --------------------------------------------------------------- 00 30 minutes 1 byte +/- 16 hours 01 minutes 4 bytes +/- 1020 years 10 seconds 5 bytes +/- 4355 years 11 millis 9 bytes +/- 292,000,000 years Remaining bits in field form signed offset from 1970-01-01T00:00:00Z.
public  voidwriteTo(String zoneID, OutputStream out)
     Encodes a built DateTimeZone to the given stream.
public  voidwriteTo(String zoneID, DataOutput out)
     Encodes a built DateTimeZone to the given stream.


Constructor Detail
DateTimeZoneBuilder
public DateTimeZoneBuilder()(Code)




Method Detail
addCutover
public DateTimeZoneBuilder addCutover(int year, char mode, int monthOfYear, int dayOfMonth, int dayOfWeek, boolean advanceDayOfWeek, int millisOfDay)(Code)
Adds a cutover for added rules. The standard offset at the cutover defaults to 0. Call setStandardOffset afterwards to change it.
Parameters:
  year - year of cutover
Parameters:
  mode - 'u' - cutover is measured against UTC, 'w' - against walloffset, 's' - against standard offset.
Parameters:
  dayOfMonth - if negative, set to ((last day of month) - ~dayOfMonth).For example, if -1, set to last day of month
Parameters:
  dayOfWeek - if 0, ignore
Parameters:
  advanceDayOfWeek - if dayOfMonth does not fall on dayOfWeek, advance todayOfWeek when true, retreat when false.
Parameters:
  millisOfDay - additional precision for specifying time of day ofcutover



addRecurringSavings
public DateTimeZoneBuilder addRecurringSavings(String nameKey, int saveMillis, int fromYear, int toYear, char mode, int monthOfYear, int dayOfMonth, int dayOfWeek, boolean advanceDayOfWeek, int millisOfDay)(Code)
Add a recurring daylight saving time rule.
Parameters:
  nameKey - name key of new rule
Parameters:
  saveMillis - milliseconds to add to standard offset
Parameters:
  fromYear - First year that rule is in effect. MIN_VALUE indicatesbeginning of time.
Parameters:
  toYear - Last year (inclusive) that rule is in effect. MAX_VALUEindicates end of time.
Parameters:
  mode - 'u' - transitions are calculated against UTC, 'w' -transitions are calculated against wall offset, 's' - transitions arecalculated against standard offset.
Parameters:
  dayOfMonth - if negative, set to ((last day of month) - ~dayOfMonth).For example, if -1, set to last day of month
Parameters:
  dayOfWeek - if 0, ignore
Parameters:
  advanceDayOfWeek - if dayOfMonth does not fall on dayOfWeek, advance todayOfWeek when true, retreat when false.
Parameters:
  millisOfDay - additional precision for specifying time of day oftransitions



readFrom
public static DateTimeZone readFrom(InputStream in, String id) throws IOException(Code)
Decodes a built DateTimeZone from the given stream, as encoded by writeTo.
Parameters:
  in - input stream to read encoded DateTimeZone from.
Parameters:
  id - time zone id to assign



readFrom
public static DateTimeZone readFrom(DataInput in, String id) throws IOException(Code)
Decodes a built DateTimeZone from the given stream, as encoded by writeTo.
Parameters:
  in - input stream to read encoded DateTimeZone from.
Parameters:
  id - time zone id to assign



readMillis
static long readMillis(DataInput in) throws IOException(Code)
Reads encoding generated by writeMillis.



setFixedSavings
public DateTimeZoneBuilder setFixedSavings(String nameKey, int saveMillis)(Code)
Set a fixed savings rule at the cutover.



setStandardOffset
public DateTimeZoneBuilder setStandardOffset(int standardOffset)(Code)
Sets the standard offset to use for newly added rules until the next cutover is added.



toDateTimeZone
public DateTimeZone toDateTimeZone(String id, boolean outputID)(Code)
Processes all the rules and builds a DateTimeZone.
Parameters:
  id - time zone id to assign
Parameters:
  outputID - true if the zone id should be output



writeMillis
static void writeMillis(DataOutput out, long millis) throws IOException(Code)
Millisecond encoding formats: upper two bits units field length approximate range --------------------------------------------------------------- 00 30 minutes 1 byte +/- 16 hours 01 minutes 4 bytes +/- 1020 years 10 seconds 5 bytes +/- 4355 years 11 millis 9 bytes +/- 292,000,000 years Remaining bits in field form signed offset from 1970-01-01T00:00:00Z.



writeTo
public void writeTo(String zoneID, OutputStream out) throws IOException(Code)
Encodes a built DateTimeZone to the given stream. Call readFrom to decode the data into a DateTimeZone object.
Parameters:
  out - output stream to receive encoded DateTimeZone.
since:
   1.5 (parameter added)



writeTo
public void writeTo(String zoneID, DataOutput out) throws IOException(Code)
Encodes a built DateTimeZone to the given stream. Call readFrom to decode the data into a DateTimeZone object.
Parameters:
  out - output stream to receive encoded DateTimeZone.
since:
   1.5 (parameter added)



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.