237 entry("ECT", "Europe/Paris"),
238 entry("IET", "America/Indiana/Indianapolis"),
239 entry("IST", "Asia/Kolkata"),
240 entry("JST", "Asia/Tokyo"),
241 entry("MIT", "Pacific/Apia"),
242 entry("NET", "Asia/Yerevan"),
243 entry("NST", "Pacific/Auckland"),
244 entry("PLT", "Asia/Karachi"),
245 entry("PNT", "America/Phoenix"),
246 entry("PRT", "America/Puerto_Rico"),
247 entry("PST", "America/Los_Angeles"),
248 entry("SST", "Pacific/Guadalcanal"),
249 entry("VST", "Asia/Ho_Chi_Minh"),
250 entry("EST", "-05:00"),
251 entry("MST", "-07:00"),
252 entry("HST", "-10:00")
253 );
254 /**
255 * Serialization version.
256 */
257 private static final long serialVersionUID = 8352817235686L;
258
259 //-----------------------------------------------------------------------
260 /**
261 * Gets the system default time-zone.
262 * <p>
263 * This queries {@link TimeZone#getDefault()} to find the default time-zone
264 * and converts it to a {@code ZoneId}. If the system default time-zone is changed,
265 * then the result of this method will also change.
266 *
267 * @return the zone ID, not null
268 * @throws DateTimeException if the converted zone ID has an invalid format
269 * @throws ZoneRulesException if the converted zone region ID cannot be found
270 */
271 public static ZoneId systemDefault() {
272 return TimeZone.getDefault().toZoneId();
273 }
274
275 /**
276 * Gets the set of available zone IDs.
607 return false;
608 }
609
610 /**
611 * A hash code for this time-zone ID.
612 *
613 * @return a suitable hash code
614 */
615 @Override
616 public int hashCode() {
617 return getId().hashCode();
618 }
619
620 //-----------------------------------------------------------------------
621 /**
622 * Defend against malicious streams.
623 *
624 * @param s the stream to read
625 * @throws InvalidObjectException always
626 */
627 private void readObject(ObjectInputStream s) throws InvalidObjectException {
628 throw new InvalidObjectException("Deserialization via serialization delegate");
629 }
630
631 /**
632 * Outputs this zone as a {@code String}, using the ID.
633 *
634 * @return a string representation of this time-zone ID, not null
635 */
636 @Override
637 public String toString() {
638 return getId();
639 }
640
641 //-----------------------------------------------------------------------
642 /**
643 * Writes the object using a
644 * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
645 * @serialData
646 * <pre>
647 * out.writeByte(7); // identifies a ZoneId (not ZoneOffset)
648 * out.writeUTF(getId());
649 * </pre>
650 * <p>
651 * When read back in, the {@code ZoneId} will be created as though using
652 * {@link #of(String)}, but without any exception in the case where the
653 * ID has a valid format, but is not in the known set of region-based IDs.
654 *
655 * @return the instance of {@code Ser}, not null
656 */
657 // this is here for serialization Javadoc
658 private Object writeReplace() {
659 return new Ser(Ser.ZONE_REGION_TYPE, this);
660 }
661
662 abstract void write(DataOutput out) throws IOException;
663
664 }
|
237 entry("ECT", "Europe/Paris"),
238 entry("IET", "America/Indiana/Indianapolis"),
239 entry("IST", "Asia/Kolkata"),
240 entry("JST", "Asia/Tokyo"),
241 entry("MIT", "Pacific/Apia"),
242 entry("NET", "Asia/Yerevan"),
243 entry("NST", "Pacific/Auckland"),
244 entry("PLT", "Asia/Karachi"),
245 entry("PNT", "America/Phoenix"),
246 entry("PRT", "America/Puerto_Rico"),
247 entry("PST", "America/Los_Angeles"),
248 entry("SST", "Pacific/Guadalcanal"),
249 entry("VST", "Asia/Ho_Chi_Minh"),
250 entry("EST", "-05:00"),
251 entry("MST", "-07:00"),
252 entry("HST", "-10:00")
253 );
254 /**
255 * Serialization version.
256 */
257 @java.io.Serial
258 private static final long serialVersionUID = 8352817235686L;
259
260 //-----------------------------------------------------------------------
261 /**
262 * Gets the system default time-zone.
263 * <p>
264 * This queries {@link TimeZone#getDefault()} to find the default time-zone
265 * and converts it to a {@code ZoneId}. If the system default time-zone is changed,
266 * then the result of this method will also change.
267 *
268 * @return the zone ID, not null
269 * @throws DateTimeException if the converted zone ID has an invalid format
270 * @throws ZoneRulesException if the converted zone region ID cannot be found
271 */
272 public static ZoneId systemDefault() {
273 return TimeZone.getDefault().toZoneId();
274 }
275
276 /**
277 * Gets the set of available zone IDs.
608 return false;
609 }
610
611 /**
612 * A hash code for this time-zone ID.
613 *
614 * @return a suitable hash code
615 */
616 @Override
617 public int hashCode() {
618 return getId().hashCode();
619 }
620
621 //-----------------------------------------------------------------------
622 /**
623 * Defend against malicious streams.
624 *
625 * @param s the stream to read
626 * @throws InvalidObjectException always
627 */
628 @java.io.Serial
629 private void readObject(ObjectInputStream s) throws InvalidObjectException {
630 throw new InvalidObjectException("Deserialization via serialization delegate");
631 }
632
633 /**
634 * Outputs this zone as a {@code String}, using the ID.
635 *
636 * @return a string representation of this time-zone ID, not null
637 */
638 @Override
639 public String toString() {
640 return getId();
641 }
642
643 //-----------------------------------------------------------------------
644 /**
645 * Writes the object using a
646 * <a href="{@docRoot}/serialized-form.html#java.time.Ser">dedicated serialized form</a>.
647 * @serialData
648 * <pre>
649 * out.writeByte(7); // identifies a ZoneId (not ZoneOffset)
650 * out.writeUTF(getId());
651 * </pre>
652 * <p>
653 * When read back in, the {@code ZoneId} will be created as though using
654 * {@link #of(String)}, but without any exception in the case where the
655 * ID has a valid format, but is not in the known set of region-based IDs.
656 *
657 * @return the instance of {@code Ser}, not null
658 */
659 // this is here for serialization Javadoc
660 @java.io.Serial
661 private Object writeReplace() {
662 return new Ser(Ser.ZONE_REGION_TYPE, this);
663 }
664
665 abstract void write(DataOutput out) throws IOException;
666
667 }
|