com.buck.commons.i18n
Class TimeZoneFile

java.lang.Object
  extended by com.buck.commons.i18n.TimeZoneFile

public class TimeZoneFile
extends Object

The implementation parses a POSIX style timezone file. The time zone file generally should be located at ${application.data.dir}/etc/timezone. There is one difference between our timezone file format and the POSIX format; we permit multiple time zones being listed in the file -- the timezone file lists the time zones available for the application to use.

The timezone file may have comment lines; comment lines are preceded by a '#' character. Each timezone is listed on a separate line. Multiple time zones per raw offset are permitted.

Author:
Robert J. Buck

Constructor Summary
TimeZoneFile()
           
 
Method Summary
static TimeZone[] getTimeZoneIds(InputStream tzInputStream)
          This method returns a list of supported time zone ids that are read from a time zone file (generally etc/timezone).
static TimeZone[] getTimeZoneIds(String timeZoneFile)
          This method returns a list of supported time zone ids that are read from a time zone file (generally etc/timezone).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeZoneFile

public TimeZoneFile()
Method Detail

getTimeZoneIds

public static TimeZone[] getTimeZoneIds(String timeZoneFile)
This method returns a list of supported time zone ids that are read from a time zone file (generally etc/timezone). If any entry in the time zone file contains an invalid id, the implementation will provide a fallback time zone id for GMT. If multiple invalid values exist, only one GMT entry will appear in the list.

The time zone array is sorted first by raw time zone offset, second by the time zone id.

Parameters:
timeZoneFile - path to timezone file
Returns:
a sorted list of timezones, sorted in timezone order

getTimeZoneIds

public static TimeZone[] getTimeZoneIds(InputStream tzInputStream)
This method returns a list of supported time zone ids that are read from a time zone file (generally etc/timezone). If any entry in the time zone file contains an invalid id, the implementation will provide a fallback time zone id for GMT. If multiple invalid values exist, only one GMT entry will appear in the list.

The time zone array is sorted first by raw time zone offset, second by the time zone id.

Parameters:
tzInputStream - input stream for the timezone file
Returns:
a sorted list of timezones, sorted in timezone order


Copyright © 2013. All Rights Reserved.