196 /**
197 * Nanos per second.
198 */
199 static final long NANOS_PER_SECOND = 1000_000_000L;
200 /**
201 * Nanos per minute.
202 */
203 static final long NANOS_PER_MINUTE = NANOS_PER_SECOND * SECONDS_PER_MINUTE;
204 /**
205 * Nanos per hour.
206 */
207 static final long NANOS_PER_HOUR = NANOS_PER_MINUTE * MINUTES_PER_HOUR;
208 /**
209 * Nanos per day.
210 */
211 static final long NANOS_PER_DAY = NANOS_PER_HOUR * HOURS_PER_DAY;
212
213 /**
214 * Serialization version.
215 */
216 private static final long serialVersionUID = 6414437269572265201L;
217
218 /**
219 * The hour.
220 */
221 private final byte hour;
222 /**
223 * The minute.
224 */
225 private final byte minute;
226 /**
227 * The second.
228 */
229 private final byte second;
230 /**
231 * The nanosecond.
232 */
233 private final int nano;
234
235 //-----------------------------------------------------------------------
1657 * out.writeByte(~hour);
1658 * } else {
1659 * out.writeByte(hour);
1660 * out.writeByte(~minute);
1661 * }
1662 * } else {
1663 * out.writeByte(hour);
1664 * out.writeByte(minute);
1665 * out.writeByte(~second);
1666 * }
1667 * } else {
1668 * out.writeByte(hour);
1669 * out.writeByte(minute);
1670 * out.writeByte(second);
1671 * out.writeInt(nano);
1672 * }
1673 * </pre>
1674 *
1675 * @return the instance of {@code Ser}, not null
1676 */
1677 private Object writeReplace() {
1678 return new Ser(Ser.LOCAL_TIME_TYPE, this);
1679 }
1680
1681 /**
1682 * Defend against malicious streams.
1683 *
1684 * @param s the stream to read
1685 * @throws InvalidObjectException always
1686 */
1687 private void readObject(ObjectInputStream s) throws InvalidObjectException {
1688 throw new InvalidObjectException("Deserialization via serialization delegate");
1689 }
1690
1691 void writeExternal(DataOutput out) throws IOException {
1692 if (nano == 0) {
1693 if (second == 0) {
1694 if (minute == 0) {
1695 out.writeByte(~hour);
1696 } else {
1697 out.writeByte(hour);
1698 out.writeByte(~minute);
1699 }
1700 } else {
1701 out.writeByte(hour);
1702 out.writeByte(minute);
1703 out.writeByte(~second);
1704 }
1705 } else {
1706 out.writeByte(hour);
|
196 /**
197 * Nanos per second.
198 */
199 static final long NANOS_PER_SECOND = 1000_000_000L;
200 /**
201 * Nanos per minute.
202 */
203 static final long NANOS_PER_MINUTE = NANOS_PER_SECOND * SECONDS_PER_MINUTE;
204 /**
205 * Nanos per hour.
206 */
207 static final long NANOS_PER_HOUR = NANOS_PER_MINUTE * MINUTES_PER_HOUR;
208 /**
209 * Nanos per day.
210 */
211 static final long NANOS_PER_DAY = NANOS_PER_HOUR * HOURS_PER_DAY;
212
213 /**
214 * Serialization version.
215 */
216 @java.io.Serial
217 private static final long serialVersionUID = 6414437269572265201L;
218
219 /**
220 * The hour.
221 */
222 private final byte hour;
223 /**
224 * The minute.
225 */
226 private final byte minute;
227 /**
228 * The second.
229 */
230 private final byte second;
231 /**
232 * The nanosecond.
233 */
234 private final int nano;
235
236 //-----------------------------------------------------------------------
1658 * out.writeByte(~hour);
1659 * } else {
1660 * out.writeByte(hour);
1661 * out.writeByte(~minute);
1662 * }
1663 * } else {
1664 * out.writeByte(hour);
1665 * out.writeByte(minute);
1666 * out.writeByte(~second);
1667 * }
1668 * } else {
1669 * out.writeByte(hour);
1670 * out.writeByte(minute);
1671 * out.writeByte(second);
1672 * out.writeInt(nano);
1673 * }
1674 * </pre>
1675 *
1676 * @return the instance of {@code Ser}, not null
1677 */
1678 @java.io.Serial
1679 private Object writeReplace() {
1680 return new Ser(Ser.LOCAL_TIME_TYPE, this);
1681 }
1682
1683 /**
1684 * Defend against malicious streams.
1685 *
1686 * @param s the stream to read
1687 * @throws InvalidObjectException always
1688 */
1689 @java.io.Serial
1690 private void readObject(ObjectInputStream s) throws InvalidObjectException {
1691 throw new InvalidObjectException("Deserialization via serialization delegate");
1692 }
1693
1694 void writeExternal(DataOutput out) throws IOException {
1695 if (nano == 0) {
1696 if (second == 0) {
1697 if (minute == 0) {
1698 out.writeByte(~hour);
1699 } else {
1700 out.writeByte(hour);
1701 out.writeByte(~minute);
1702 }
1703 } else {
1704 out.writeByte(hour);
1705 out.writeByte(minute);
1706 out.writeByte(~second);
1707 }
1708 } else {
1709 out.writeByte(hour);
|