APIdia Launch Partner
Top Description Fields Constructors Methods
java.time.zone

pack-priv final Class TzdbZoneRulesProvider

extends ZoneRulesProvider
Class Inheritance
Imports
jdk.internal.util.StaticProperty, java.io.ByteArrayInputStream, .BufferedInputStream, .DataInputStream, .File, .FileInputStream, .StreamCorruptedException, java.util.Arrays, .HashSet, .List, .Map, .NavigableMap, .Set, .TreeMap, java.util.concurrent.ConcurrentHashMap

Loads time-zone rules for 'TZDB'.
Since
1.8

Field Summary

Modifier and TypeField and Description
private List<String>
regionIds

All the regions that are available.

private final Map<String, Object>
regionToRules

Region to rules mapping

private String
versionId

Version Id of this tzdb rules

Constructor Summary

AccessConstructor and Description
public
TzdbZoneRulesProvider()

Creates an instance.

Method Summary

Modifier and TypeMethod and Description
private void
load(DataInputStream
the DateInputStream to load, not null
dis
)

Loads the rules from a DateInputStream, often in a jar file.

protected ZoneRules
provideRules(String zoneId, boolean forCaching)

Implements abstract java.time.zone.ZoneRulesProvider.provideRules.

SPI method to get the rules for the zone ID.

This loads the rules for the specified zone ID. The provider implementation must validate that the zone ID is valid and available, throwing a ZoneRulesException if it is not.

protected NavigableMap<String, ZoneRules>
provideVersions(String zoneId)

Implements abstract java.time.zone.ZoneRulesProvider.provideVersions.

SPI method to get the history of rules for the zone ID.

This returns a map of historical rules keyed by a version string.

protected Set<String>
provideZoneIds()

Implements abstract java.time.zone.ZoneRulesProvider.provideZoneIds.

SPI method to get the available zone IDs.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.time.zone.ZoneRulesProvider:
getAvailableZoneIdsgetRulesgetVersionsprovideRefreshrefreshregisterProvider

Field Detail

regionIdsback to summary
private List<String> regionIds

All the regions that are available.

regionToRulesback to summary
private final Map<String, Object> regionToRules

Region to rules mapping

versionIdback to summary
private String versionId

Version Id of this tzdb rules

Constructor Detail

TzdbZoneRulesProviderback to summary
public TzdbZoneRulesProvider()

Creates an instance. Created by the ServiceLoader.

Exceptions
ZoneRulesException:
if unable to load

Method Detail

loadback to summary
private void load(DataInputStream dis) throws Exception

Loads the rules from a DateInputStream, often in a jar file.

Parameters
dis:DataInputStream

the DateInputStream to load, not null

Exceptions
Exception:
if an error occurs
provideRulesback to summary
protected ZoneRules provideRules(String zoneId, boolean forCaching)

Implements abstract java.time.zone.ZoneRulesProvider.provideRules.

Doc from java.time.zone.ZoneRulesProvider.provideRules.

SPI method to get the rules for the zone ID.

This loads the rules for the specified zone ID. The provider implementation must validate that the zone ID is valid and available, throwing a ZoneRulesException if it is not. The result of the method in the valid case depends on the caching flag.

If the provider implementation is not dynamic, then the result of the method must be the non-null set of rules selected by the ID.

If the provider implementation is dynamic, then the flag gives the option of preventing the returned rules from being cached in ZoneId. When the flag is true, the provider is permitted to return null, where null will prevent the rules from being cached in ZoneId. When the flag is false, the provider must return non-null rules.

Annotations
@Override
provideVersionsback to summary
protected NavigableMap<String, ZoneRules> provideVersions(String zoneId)

Implements abstract java.time.zone.ZoneRulesProvider.provideVersions.

Doc from java.time.zone.ZoneRulesProvider.provideVersions.

SPI method to get the history of rules for the zone ID.

This returns a map of historical rules keyed by a version string. The exact meaning and format of the version is provider specific. The version must follow lexicographical order, thus the returned map will be order from the oldest known rules to the newest available rules. The default 'TZDB' group uses version numbering consisting of the year followed by a letter, such as '2009e' or '2012f'.

Implementations must provide a result for each valid zone ID, however they do not have to provide a history of rules. Thus the map will contain at least one element, and will only contain more than one element if historical rule information is available.

The returned versions remain available and valid for the lifetime of the application. A dynamic provider may increase the set of versions as more data becomes available.

Annotations
@Override
provideZoneIdsback to summary
protected Set<String> provideZoneIds()

Implements abstract java.time.zone.ZoneRulesProvider.provideZoneIds.

Doc from java.time.zone.ZoneRulesProvider.provideZoneIds.

SPI method to get the available zone IDs.

This obtains the IDs that this ZoneRulesProvider provides. A provider should provide data for at least one zone ID.

The returned zone IDs remain available and valid for the lifetime of the application. A dynamic provider may increase the set of IDs as more data becomes available.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override