equal
deleted
inserted
replaced
1901 /** |
1901 /** |
1902 * Writes the object using a |
1902 * Writes the object using a |
1903 * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>. |
1903 * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>. |
1904 * @serialData |
1904 * @serialData |
1905 * <pre> |
1905 * <pre> |
1906 * out.writeByte(10); // identifies a OffsetDateTime |
1906 * out.writeByte(10); // identifies an OffsetDateTime |
1907 * out.writeObject(dateTime); |
1907 * // the <a href="../../serialized-form.html#java.time.LocalDateTime">datetime</a> excluding the one byte header |
1908 * out.writeObject(offset); |
1908 * // the <a href="../../serialized-form.html#java.time.ZoneOffset">offset</a> excluding the one byte header |
1909 * </pre> |
1909 * </pre> |
1910 * |
1910 * |
1911 * @return the instance of {@code Ser}, not null |
1911 * @return the instance of {@code Ser}, not null |
1912 */ |
1912 */ |
1913 private Object writeReplace() { |
1913 private Object writeReplace() { |
1922 private Object readResolve() throws InvalidObjectException { |
1922 private Object readResolve() throws InvalidObjectException { |
1923 throw new InvalidObjectException("Deserialization via serialization delegate"); |
1923 throw new InvalidObjectException("Deserialization via serialization delegate"); |
1924 } |
1924 } |
1925 |
1925 |
1926 void writeExternal(ObjectOutput out) throws IOException { |
1926 void writeExternal(ObjectOutput out) throws IOException { |
1927 out.writeObject(dateTime); |
1927 dateTime.writeExternal(out); |
1928 out.writeObject(offset); |
1928 offset.writeExternal(out); |
1929 } |
1929 } |
1930 |
1930 |
1931 static OffsetDateTime readExternal(ObjectInput in) throws IOException, ClassNotFoundException { |
1931 static OffsetDateTime readExternal(ObjectInput in) throws IOException, ClassNotFoundException { |
1932 LocalDateTime dateTime = (LocalDateTime) in.readObject(); |
1932 LocalDateTime dateTime = LocalDateTime.readExternal(in); |
1933 ZoneOffset offset = (ZoneOffset) in.readObject(); |
1933 ZoneOffset offset = ZoneOffset.readExternal(in); |
1934 return OffsetDateTime.of(dateTime, offset); |
1934 return OffsetDateTime.of(dateTime, offset); |
1935 } |
1935 } |
1936 |
1936 |
1937 } |
1937 } |