Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.joda.time.tz
Class ZoneInfoProvider  view ZoneInfoProvider download ZoneInfoProvider.java

java.lang.Object
  extended byorg.joda.time.tz.ZoneInfoProvider
All Implemented Interfaces:
Provider

public class ZoneInfoProvider
extends java.lang.Object
implements Provider

ZoneInfoProvider loads compiled data files as generated by ZoneInfoCompiler.

ZoneInfoProvider is thread-safe and publicly immutable.

Since:
1.0

Field Summary
private  java.io.File iFileDir
          The directory where the files are held.
private  java.lang.ClassLoader iLoader
          The class loader to use.
private  java.lang.String iResourcePath
          The resource path.
private  java.util.Map iZoneInfoMap
          Maps ids to strings or SoftReferences to DateTimeZones.
 
Constructor Summary
  ZoneInfoProvider(java.io.File fileDir)
          ZoneInfoProvider searches the given directory for compiled data files.
  ZoneInfoProvider(java.lang.String resourcePath)
          ZoneInfoProvider searches the given ClassLoader resource path for compiled data files.
  ZoneInfoProvider(java.lang.String resourcePath, java.lang.ClassLoader loader)
          ZoneInfoProvider searches the given ClassLoader resource path for compiled data files.
private ZoneInfoProvider(java.lang.String resourcePath, java.lang.ClassLoader loader, boolean favorSystemLoader)
           
 
Method Summary
 java.util.Set getAvailableIDs()
          Gets a list of all the available zone ids.
 org.joda.time.DateTimeZone getZone(java.lang.String id)
          If an error is thrown while loading zone data, uncaughtException is called to log the error and null is returned for this and all future requests.
private  org.joda.time.DateTimeZone loadZoneData(java.lang.String id)
          Loads the time zone data for one id.
private static java.util.Map loadZoneInfoMap(java.io.InputStream in)
          Loads the zone info map.
private  java.io.InputStream openResource(java.lang.String name)
          Opens a resource from file or classpath.
private static void readZoneInfoMap(java.io.DataInputStream din, java.util.Map zimap)
          Reads the zone info map from file.
protected  void uncaughtException(java.lang.Exception ex)
          Called if an exception is thrown from getZone while loading zone data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

iFileDir

private final java.io.File iFileDir
The directory where the files are held.


iResourcePath

private final java.lang.String iResourcePath
The resource path.


iLoader

private final java.lang.ClassLoader iLoader
The class loader to use.


iZoneInfoMap

private final java.util.Map iZoneInfoMap
Maps ids to strings or SoftReferences to DateTimeZones.

Constructor Detail

ZoneInfoProvider

public ZoneInfoProvider(java.io.File fileDir)
                 throws java.io.IOException
ZoneInfoProvider searches the given directory for compiled data files.


ZoneInfoProvider

public ZoneInfoProvider(java.lang.String resourcePath)
                 throws java.io.IOException
ZoneInfoProvider searches the given ClassLoader resource path for compiled data files. Resources are loaded from the ClassLoader that loaded this class.


ZoneInfoProvider

public ZoneInfoProvider(java.lang.String resourcePath,
                        java.lang.ClassLoader loader)
                 throws java.io.IOException
ZoneInfoProvider searches the given ClassLoader resource path for compiled data files.


ZoneInfoProvider

private ZoneInfoProvider(java.lang.String resourcePath,
                         java.lang.ClassLoader loader,
                         boolean favorSystemLoader)
                  throws java.io.IOException
Method Detail

getZone

public org.joda.time.DateTimeZone getZone(java.lang.String id)
If an error is thrown while loading zone data, uncaughtException is called to log the error and null is returned for this and all future requests.

Specified by:
getZone in interface Provider

getAvailableIDs

public java.util.Set getAvailableIDs()
Gets a list of all the available zone ids.

Specified by:
getAvailableIDs in interface Provider

uncaughtException

protected void uncaughtException(java.lang.Exception ex)
Called if an exception is thrown from getZone while loading zone data.


openResource

private java.io.InputStream openResource(java.lang.String name)
                                  throws java.io.IOException
Opens a resource from file or classpath.


loadZoneData

private org.joda.time.DateTimeZone loadZoneData(java.lang.String id)
Loads the time zone data for one id.


loadZoneInfoMap

private static java.util.Map loadZoneInfoMap(java.io.InputStream in)
                                      throws java.io.IOException
Loads the zone info map.


readZoneInfoMap

private static void readZoneInfoMap(java.io.DataInputStream din,
                                    java.util.Map zimap)
                             throws java.io.IOException
Reads the zone info map from file.