private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(1); // identifies a Duration out.writeLong(seconds); out.writeInt(nanos);
long seconds
int nanos
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(2); // identifies an Instant out.writeLong(seconds); out.writeInt(nanos);
long seconds
int nanos
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(3); // identifies a LocalDate out.writeInt(year); out.writeByte(month); out.writeByte(day);
int year
short month
short day
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(4); // identifies a LocalTime
if (nano == 0) {
if (second == 0) {
if (minute == 0) {
out.writeByte(~hour);
} else {
out.writeByte(hour);
out.writeByte(~minute);
}
} else {
out.writeByte(hour);
out.writeByte(minute);
out.writeByte(~second);
}
} else {
out.writeByte(hour);
out.writeByte(minute);
out.writeByte(second);
out.writeInt(nano);
}
byte hour
byte minute
byte second
int nano
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(13); // identifies a MonthDay out.writeByte(month); out.writeByte(day);
int month
int day
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
LocalDateTime dateTime
ZoneOffset offset
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
LocalTime time
ZoneOffset offset
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(14); // identifies a Period out.writeInt(years); out.writeInt(months); out.writeInt(days);
int years
int months
int days
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
Externalizable interface to read the object.writeReplace
method are read and passed to the corresponding static factory for the type
to create a new instance. That instance is returned as the de-serialized
Ser object.
Duration.ofSeconds(seconds, nanos);
Instant.ofEpochSecond(seconds, nanos);
LocalDate.of(year, month, day);
LocalDateTime.of(date, time);
LocalTime.of(hour, minute, second, nano);
MonthDay.of(month, day);
OffsetTime.of(time, offset);
OffsetDateTime.of(dateTime, offset);
Period.of(years, months, days);
Year.of(year);
YearMonth.of(year, month);
ZonedDateTime.ofLenient(dateTime, offset, zone);
ZoneId.of(id);
(offsetByte == 127 ? ZoneOffset.ofTotalSeconds(in.readInt()) : ZoneOffset.ofTotalSeconds(offsetByte * 900));
java.io.IOException - if I/O errors occurjava.lang.ClassNotFoundException - If the class for an object being
restored cannot be found.public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
Externalizable interface to write the object.writeReplace
serialized form for the value of the type and sequence of values for the type.
java.io.IOException - Includes any I/O exceptions that may occurprivate void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(11); // identifies a Year out.writeInt(year);
int year
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(12); // identifies a YearMonth out.writeInt(year); out.writeByte(month);
int year
int month
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
LocalDateTime dateTime
ZoneOffset offset
ZoneId zone
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(7); // identifies a ZoneId (not ZoneOffset) out.writeUTF(getId());
When read back in, the ZoneId will be created as though using
ZoneId.of(String), but without any exception in the case where the
ID has a valid format, but is not in the known set of region-based IDs.
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(8); // identifies a ZoneOffset
int offsetByte = totalSeconds % 900 == 0 ? totalSeconds / 900 : 127;
out.writeByte(offsetByte);
if (offsetByte == 127) {
out.writeInt(totalSeconds);
}
int totalSeconds
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(2); // identifies a ChronoLocalDateTime out.writeObject(toLocalDate()); out.witeObject(toLocalTime());
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(3); // identifies a ChronoZonedDateTime out.writeObject(toLocalDateTime()); out.writeObject(getOffset()); out.writeObject(getZone());
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysjava.lang.Object writeReplace()
out.writeByte(1); // identifies a Chronology out.writeUTF(getId());
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(6); // identifies a HijrahDate out.writeObject(chrono); // the HijrahChronology variant out.writeInt(get(YEAR)); out.writeByte(get(MONTH_OF_YEAR)); out.writeByte(get(DAY_OF_MONTH));
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysjava.lang.Object writeReplace()
out.writeByte(1); // identifies a Chronology out.writeUTF(getId());
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysjava.lang.Object writeReplace()
out.writeByte(1); // identifies a Chronology out.writeUTF(getId());
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(4); // identifies a JapaneseDate out.writeInt(get(YEAR)); out.writeByte(get(MONTH_OF_YEAR)); out.writeByte(get(DAY_OF_MONTH));
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(5); // identifies a JapaneseEra out.writeInt(getValue());
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysjava.lang.Object writeReplace()
out.writeByte(1); // identifies a Chronology out.writeUTF(getId());
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(8); // identifies a MinguoDate out.writeInt(get(YEAR)); out.writeByte(get(MONTH_OF_YEAR)); out.writeByte(get(DAY_OF_MONTH));
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
Externalizable interface to read the object.writeReplace
method are read and passed to the corresponding static factory for the type
to create a new instance. That instance is returned as the de-serialized
Ser object.
java.io.IOException - if I/O errors occurjava.lang.ClassNotFoundException - If the class for an object being
restored cannot be found.public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
Externalizable interface to write the object.writeReplace
serialized form for the value of the type and sequence of values for the type.
java.io.IOException - Includes any I/O exceptions that may occurprivate void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysjava.lang.Object writeReplace()
out.writeByte(1); // identifies a Chronology out.writeUTF(getId());
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(10); // identifies a ThaiBuddhistDate out.writeInt(get(YEAR)); out.writeByte(get(MONTH_OF_YEAR)); out.writeByte(get(DAY_OF_MONTH));
java.lang.String parsedString
int errorIndex
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException,
java.lang.ClassNotFoundException,
java.io.InvalidObjectException
java.io.InvalidObjectException - if
the smallest minimum is greater than the smallest maximum,
or the smallest maximum is greater than the largest maximum
or the largest minimum is greater than the largest maximumjava.io.IOExceptionjava.lang.ClassNotFoundExceptionlong minSmallest
long minLargest
long maxSmallest
long maxLargest
private void readObject(java.io.ObjectInputStream s)
throws java.io.IOException,
java.lang.ClassNotFoundException,
java.io.InvalidObjectException
java.io.InvalidObjectException - if the serialized object has an invalid
value for firstDayOfWeek or minimalDays.java.io.IOExceptionjava.lang.ClassNotFoundExceptionprivate java.lang.Object readResolve()
throws java.io.InvalidObjectException
firstDayOfWeek and minimalDays.java.io.InvalidObjectException - if the serialized object has invalid
values for firstDayOfWeek or minimalDays.DayOfWeek firstDayOfWeek
int minimalDays
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
Externalizable interface to read the object.writeReplace
method are read and passed to the corresponding static factory for the type
to create a new instance. That instance is returned as the de-serialized
Ser object.
ZoneRules.of(standardTransitions, standardOffsets, savingsInstantTransitions, wallOffsets, lastRules);
ZoneOffsetTransition of(LocalDateTime.ofEpochSecond(epochSecond), offsetBefore, offsetAfter);
ZoneOffsetTransitionRule.of(month, dom, dow, time, timeEndOfDay, timeDefinition, standardOffset, offsetBefore, offsetAfter);
java.io.IOException - if I/O errors occurjava.lang.ClassNotFoundException - If the class for an object being
restored cannot be found.public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
Externalizable interface to write the object.writeReplace
serialized form for the value of the type and sequence of values for the type.
java.io.IOException - Includes any I/O exceptions that may occurprivate void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(2); // identifies a ZoneOffsetTransition
out.writeEpochSec(toEpochSecond);
out.writeOffset(offsetBefore);
out.writeOffset(offsetAfter);
LocalDateTime transition
ZoneOffset offsetBefore
ZoneOffset offsetAfter
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(3); // identifies a ZoneOffsetTransition
final int timeSecs = (timeEndOfDay ? 86400 : time.toSecondOfDay());
final int stdOffset = standardOffset.getTotalSeconds();
final int beforeDiff = offsetBefore.getTotalSeconds() - stdOffset;
final int afterDiff = offsetAfter.getTotalSeconds() - stdOffset;
final int timeByte = (timeSecs % 3600 == 0 ? (timeEndOfDay ? 24 : time.getHour()) : 31);
final int stdOffsetByte = (stdOffset % 900 == 0 ? stdOffset / 900 + 128 : 255);
final int beforeByte = (beforeDiff == 0 || beforeDiff == 1800 || beforeDiff == 3600 ? beforeDiff / 1800 : 3);
final int afterByte = (afterDiff == 0 || afterDiff == 1800 || afterDiff == 3600 ? afterDiff / 1800 : 3);
final int dowByte = (dow == null ? 0 : dow.getValue());
int b = (month.getValue() << 28) + // 4 bits
((dom + 32) << 22) + // 6 bits
(dowByte << 19) + // 3 bits
(timeByte << 14) + // 5 bits
(timeDefinition.ordinal() << 12) + // 2 bits
(stdOffsetByte << 4) + // 8 bits
(beforeByte << 2) + // 2 bits
afterByte; // 2 bits
out.writeInt(b);
if (timeByte == 31) {
out.writeInt(timeSecs);
}
if (stdOffsetByte == 255) {
out.writeInt(stdOffset);
}
if (beforeByte == 3) {
out.writeInt(offsetBefore.getTotalSeconds());
}
if (afterByte == 3) {
out.writeInt(offsetAfter.getTotalSeconds());
}
Month month
byte dom
-1 is the last day of the month, -2 is the second
to last day, and so on.DayOfWeek dow
LocalTime time
boolean timeEndOfDay
ZoneOffsetTransitionRule.TimeDefinition timeDefinition
ZoneOffset standardOffset
ZoneOffset offsetBefore
ZoneOffset offsetAfter
private void readObject(java.io.ObjectInputStream s)
throws java.io.InvalidObjectException
java.io.InvalidObjectException - alwaysprivate java.lang.Object writeReplace()
out.writeByte(1); // identifies a ZoneRules
out.writeInt(standardTransitions.length);
for (long trans : standardTransitions) {
Ser.writeEpochSec(trans, out);
}
for (ZoneOffset offset : standardOffsets) {
Ser.writeOffset(offset, out);
}
out.writeInt(savingsInstantTransitions.length);
for (long trans : savingsInstantTransitions) {
Ser.writeEpochSec(trans, out);
}
for (ZoneOffset offset : wallOffsets) {
Ser.writeOffset(offset, out);
}
out.writeByte(lastRules.length);
for (ZoneOffsetTransitionRule rule : lastRules) {
rule.writeExternal(out);
}
Epoch second values used for offsets are encoded in a variable length form to make the common cases put fewer bytes in the stream.
static void writeEpochSec(long epochSec, DataOutput out) throws IOException {
if (epochSec >= -4575744000L && epochSec < 10413792000L && epochSec % 900 == 0) { // quarter hours between 1825 and 2300
int store = (int) ((epochSec + 4575744000L) / 900);
out.writeByte((store >>> 16) & 255);
out.writeByte((store >>> 8) & 255);
out.writeByte(store & 255);
} else {
out.writeByte(255);
out.writeLong(epochSec);
}
}
ZoneOffset values are encoded in a variable length form so the common cases put fewer bytes in the stream.
static void writeOffset(ZoneOffset offset, DataOutput out) throws IOException {
final int offsetSecs = offset.getTotalSeconds();
int offsetByte = offsetSecs % 900 == 0 ? offsetSecs / 900 : 127; // compress to -72 to +72
out.writeByte(offsetByte);
if (offsetByte == 127) {
out.writeInt(offsetSecs);
}
}
long[] standardTransitions
ZoneOffset[] standardOffsets
long[] savingsInstantTransitions
LocalDateTime[] savingsLocalTransitions
ZoneOffset[] wallOffsets
ZoneOffsetTransitionRule[] lastRules
Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved. Use of this specification is subject to license terms.