APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.util.calendar

public final Class ZoneInfoFile

extends Object
Class Inheritance
Imports
java.io.ByteArrayInputStream, .BufferedInputStream, .DataInput, .DataInputStream, .File, .FileInputStream, .IOException, .StreamCorruptedException, java.time.LocalDateTime, .ZoneId, .ZoneOffset, java.util.ArrayList, .Arrays, .Calendar, .Collections, .HashMap, .List, .Map, .SimpleTimeZone, java.util.concurrent.ConcurrentHashMap, java.util.stream.Stream, java.util.zip.CRC32, jdk.internal.util.StaticProperty

Loads TZDB time-zone rules for j.u.TimeZone

Since
1.8

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final Map<String, String>
private static final long
pack-priv static final long
pack-priv static final int
private static final long
private static final int
private static int[]
private static final int
private static final long
private static final long
private static String[]
private static byte[][]
pack-priv static final int
private static final int[]
private static final int[]
private static final int
private static final long
private static final long
private static String
private static final Map<String, ZoneInfo>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static int
addTrans(long[] transitions, int nTrans, int[] offsets, int nOffsets, long trans, int offset, int stdOffset)

public static Map<String, String>

Returns:

an unmodified alias mapping
getAliasMap
()

Returns a Map from alias time zone IDs to their standard time zone IDs.

public static ZoneInfo

Returns:

a ZoneInfo constructed with the given GMT offset
getCustomTimeZone
(String
the given custom id (before normalized such as "GMT+9")
originalId
,
int
GMT offset in milliseconds
gmtOffset
)

Gets a ZoneInfo with the given GMT offset.

private static int
getStandardOffset(long[] standardTransitions, int[] standardOffsets, long epochSec)

public static String

Returns:

the tzdb version
getVersion
()

Gets the version of this tz data.

private static int
getYear(long epochSecond, int offset)

public static String[]

Returns:

an array of time zone IDs.
getZoneIds
()

Gets all available IDs supported in the Java run-time.

public static String[]

Returns:

an array of time zone IDs.
getZoneIds
(int
the GMT offset in milliseconds. This value should not include any daylight saving time.
rawOffset
)

Gets all available IDs that have the same value as the specified raw GMT offset.

public static ZoneInfo
public static ZoneInfo
private static ZoneInfo
getZoneInfo(String zoneId, long[]
the standard transitions, not null
standardTransitions
,
int[]
the standard offsets, not null
standardOffsets
,
long[]
the standard transitions, not null
savingsInstantTransitions
,
int[]
the wall offsets, not null
wallOffsets
,
ZoneInfoFile.ZoneOffsetTransitionRule[]
the recurring last rules, size 15 or less, not null
lastRules
)

Get a ZoneInfo instance.

private static ZoneInfo
private static int
indexOf(int[] offsets, int from, int nOffsets, int offset)

private static void
load(DataInputStream
the DateInputStream to load, not null
dis
)

Loads the rules from a DateInputStream

private static void
pack-priv static long
public static int
public static String
toCustomID(int gmtOffset)

public static Stream<String>

Returns:

a stream of time zone IDs.
zoneIds
()

Gets all available IDs supported in the Java run-time.

public static Stream<String>

Returns:

a stream of time zone IDs.
zoneIds
(int
the GMT offset in milliseconds. This value should not include any daylight saving time.
rawOffset
)

Gets all available IDs that have the same value as the specified raw GMT offset.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

aliasesback to summary
private static final Map<String, String> aliases
CURRTback to summary
private static final long CURRT
DAYS_0000_TO_1970back to summary
pack-priv static final long DAYS_0000_TO_1970
DAYS_PER_CYCLEback to summary
pack-priv static final int DAYS_PER_CYCLE
DST_MASKback to summary
private static final long DST_MASK
DST_NSHIFTback to summary
private static final int DST_NSHIFT
indicesback to summary
private static int[] indices
LASTYEARback to summary
private static final int LASTYEAR
LDT2100back to summary
private static final long LDT2100
OFFSET_MASKback to summary
private static final long OFFSET_MASK
regionsback to summary
private static String[] regions
ruleArrayback to summary
private static byte[][] ruleArray
SECONDS_PER_DAYback to summary
pack-priv static final int SECONDS_PER_DAY
toCalendarDOWback to summary
private static final int[] toCalendarDOW
toSTZTimeback to summary
private static final int[] toSTZTime
TRANSITION_NSHIFTback to summary
private static final int TRANSITION_NSHIFT
UTC1900back to summary
private static final long UTC1900
UTC2100back to summary
private static final long UTC2100
versionIdback to summary
private static String versionId
zonesback to summary
private static final Map<String, ZoneInfo> zones

Constructor Detail

ZoneInfoFileback to summary
private ZoneInfoFile()

Method Detail

addTransback to summary
private static int addTrans(long[] transitions, int nTrans, int[] offsets, int nOffsets, long trans, int offset, int stdOffset)
getAliasMapback to summary
public static Map<String, String> getAliasMap()

Returns a Map from alias time zone IDs to their standard time zone IDs.

Returns:Map<String, String>

an unmodified alias mapping

getCustomTimeZoneback to summary
public static ZoneInfo getCustomTimeZone(String originalId, int gmtOffset)

Gets a ZoneInfo with the given GMT offset. The object has its ID in the format of GMT{+|-}hh:mm.

Parameters
originalId:String

the given custom id (before normalized such as "GMT+9")

gmtOffset:int

GMT offset in milliseconds

Returns:ZoneInfo

a ZoneInfo constructed with the given GMT offset

getStandardOffsetback to summary
private static int getStandardOffset(long[] standardTransitions, int[] standardOffsets, long epochSec)
getVersionback to summary
public static String getVersion()

Gets the version of this tz data.

Returns:String

the tzdb version

getYearback to summary
private static int getYear(long epochSecond, int offset)
getZoneIdsback to summary
public static String[] getZoneIds()

Gets all available IDs supported in the Java run-time.

Returns:String[]

an array of time zone IDs.

getZoneIdsback to summary
public static String[] getZoneIds(int rawOffset)

Gets all available IDs that have the same value as the specified raw GMT offset.

Parameters
rawOffset:int

the GMT offset in milliseconds. This value should not include any daylight saving time.

Returns:String[]

an array of time zone IDs.

getZoneInfoback to summary
public static ZoneInfo getZoneInfo(String zoneId)
getZoneInfoback to summary
public static ZoneInfo getZoneInfo(DataInput in, String zoneId) throws Exception
getZoneInfoback to summary
private static ZoneInfo getZoneInfo(String zoneId, long[] standardTransitions, int[] standardOffsets, long[] savingsInstantTransitions, int[] wallOffsets, ZoneInfoFile.ZoneOffsetTransitionRule[] lastRules)

Get a ZoneInfo instance.

Parameters
standardTransitions:long[]

the standard transitions, not null

standardOffsets:int[]

the standard offsets, not null

savingsInstantTransitions:long[]

the standard transitions, not null

wallOffsets:int[]

the wall offsets, not null

lastRules:ZoneInfoFile.ZoneOffsetTransitionRule[]

the recurring last rules, size 15 or less, not null

getZoneInfo0back to summary
private static ZoneInfo getZoneInfo0(String zoneId)
indexOfback to summary
private static int indexOf(int[] offsets, int from, int nOffsets, int offset)
loadback to summary
private static void load(DataInputStream dis) throws IOException

Loads the rules from a DateInputStream

Parameters
dis:DataInputStream

the DateInputStream to load, not null

Exceptions
IOException:
if an error occurs
loadTZDBback to summary
private static void loadTZDB()
readEpochSecback to summary
pack-priv static long readEpochSec(DataInput in) throws IOException
readOffsetback to summary
public static int readOffset(DataInput in) throws IOException
toCustomIDback to summary
public static String toCustomID(int gmtOffset)
zoneIdsback to summary
public static Stream<String> zoneIds()

Gets all available IDs supported in the Java run-time.

Returns:Stream<String>

a stream of time zone IDs.

zoneIdsback to summary
public static Stream<String> zoneIds(int rawOffset)

Gets all available IDs that have the same value as the specified raw GMT offset.

Parameters
rawOffset:int

the GMT offset in milliseconds. This value should not include any daylight saving time.

Returns:Stream<String>

a stream of time zone IDs.

sun.util.calendar back to summary

private Class ZoneInfoFile.Checksum

extends CRC32
Class Inheritance

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
update(int val)

Overrides java.util.zip.CRC32.update.

Implements java.util.zip.Checksum.update.

Updates the CRC-32 checksum with the specified byte (the low eight bits of the argument b).

pack-priv void
update(long val)

Inherited from java.util.zip.CRC32:
getValueresetupdateupdate

Constructor Detail

Checksumback to summary
private Checksum()

Method Detail

updateback to summary
public void update(int val)

Overrides java.util.zip.CRC32.update.

Implements java.util.zip.Checksum.update.

Doc from java.util.zip.CRC32.update.

Updates the CRC-32 checksum with the specified byte (the low eight bits of the argument b).

updateback to summary
pack-priv void update(long val)
sun.util.calendar back to summary

private Class ZoneInfoFile.ZoneOffsetTransitionRule

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final byte
private final int
private final int
private final int
private final int
private final int
private final int
private final int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static final long
adjust(long epochDay, int dow, int relative)

pack-priv long
pack-priv static final boolean
isLeapYear(int year)

pack-priv static final int
lengthOfMonth(int year, int month)

pack-priv static final long
nextOrSame(long epochDay, int dayOfWeek)

pack-priv static final long
previousOrSame(long epochDay, int dayOfWeek)

pack-priv static final long
toEpochDay(int year, int month, int day)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

domback to summary
private final byte dom
dowback to summary
private final int dow
monthback to summary
private final int month
offsetAfterback to summary
private final int offsetAfter
offsetBeforeback to summary
private final int offsetBefore
secondOfDayback to summary
private final int secondOfDay
standardOffsetback to summary
private final int standardOffset
timeDefinitionback to summary
private final int timeDefinition

Constructor Detail

ZoneOffsetTransitionRuleback to summary
pack-priv ZoneOffsetTransitionRule(DataInput in) throws IOException

Method Detail

adjustback to summary
pack-priv static final long adjust(long epochDay, int dow, int relative)
getTransitionEpochSecondback to summary
pack-priv long getTransitionEpochSecond(int year)
isLeapYearback to summary
pack-priv static final boolean isLeapYear(int year)
lengthOfMonthback to summary
pack-priv static final int lengthOfMonth(int year, int month)
nextOrSameback to summary
pack-priv static final long nextOrSame(long epochDay, int dayOfWeek)
previousOrSameback to summary
pack-priv static final long previousOrSame(long epochDay, int dayOfWeek)
toEpochDayback to summary
pack-priv static final long toEpochDay(int year, int month, int day)