public class TZifTimeZone extends TimeZone
Constructor and Description |
---|
TZifTimeZone(String fullName,
byte[] src,
int offset,
int length)
Create a TZifTimeZone from the bytes of a TZif file.
|
Modifier and Type | Method and Description |
---|---|
static TZifTimeZone |
fromFile(String fullName,
File src)
A convenience method to create a TZifTimeZone from a File source.
|
String |
getDisplayName(boolean dst,
int style,
Locale locale)
This method returns a string name of the time zone suitable
for displaying to the user.
|
int |
getDSTSavings()
Return the most up-to-date Daylight Savings Time change in
milliseconds.
|
int |
getOffset(int era,
int year,
int month,
int day,
int dayOfWeek,
int milliseconds)
Gets the time zone offset, for current date, modified in case of
daylight savings.
|
int |
getRawOffset()
Gets the time zone offset, ignoring daylight savings.
|
boolean |
inDaylightTime(Date date)
Returns true, if the given date is in Daylight Savings Time in this
time zone.
|
void |
setRawOffset(int offsetMillis)
This does nothing - the raw offset is decoded from the file.
|
boolean |
useDaylightTime()
Returns if this TimeZone uses daylight savings.
|
clone, getAvailableIDs, getAvailableIDs, getDefault, getDisplayName, getDisplayName, getDisplayName, getID, getTimeZone, hasSameRules, setDefault, setID
public TZifTimeZone(String fullName, byte[] src, int offset, int length) throws IllegalArgumentException
src
- the data bytes.offset
- the start of the data bytes.length
- the number of data bytes.IllegalArgumentException
- if the data bytes are not a TZif
formatted file.public String getDisplayName(boolean dst, int style, Locale locale)
TimeZone
getDisplayName
in class TimeZone
dst
- Whether or not daylight savings time is in effect.style
- LONG
for a long name, SHORT
for
a short abbreviation.locale
- The locale for this timezone name.public static TZifTimeZone fromFile(String fullName, File src) throws IOException, IllegalArgumentException
fullName
- the full name for the TZifTimeZone (e.g. "America/Port_Of_Spain") this may be null
if it is not known.src
- the source file.IOException
- if there was an error reading from the file.IllegalArgumentException
- if the file was not of the proper format.public int getOffset(int era, int year, int month, int day, int dayOfWeek, int milliseconds)
TimeZone
getOffset
in class TimeZone
era
- the era of the given dateyear
- the year of the given datemonth
- the month of the given date, 0 for January.day
- the day of monthdayOfWeek
- the day of weekmilliseconds
- the millis in the day (in local standard time)public int getRawOffset()
TimeZone
getRawOffset
in class TimeZone
public boolean inDaylightTime(Date date)
TimeZone
inDaylightTime
in class TimeZone
date
- the given Date.public void setRawOffset(int offsetMillis)
setRawOffset
in class TimeZone
offsetMillis
- the time zone offset to GMT.public int getDSTSavings()
getDSTSavings
in class TimeZone
public boolean useDaylightTime()
useDaylightTime
in class TimeZone