jdk/src/share/classes/java/time/Period.java
changeset 19841 15c8e97d6a14
parent 19030 32f129cb6351
child 20519 eee7a92074fd
equal deleted inserted replaced
19822:4e10a58fa28f 19841:15c8e97d6a14
    68 
    68 
    69 import java.io.DataInput;
    69 import java.io.DataInput;
    70 import java.io.DataOutput;
    70 import java.io.DataOutput;
    71 import java.io.IOException;
    71 import java.io.IOException;
    72 import java.io.InvalidObjectException;
    72 import java.io.InvalidObjectException;
    73 import java.io.ObjectStreamException;
    73 import java.io.InvalidObjectException;
    74 import java.io.Serializable;
    74 import java.io.Serializable;
    75 import java.time.chrono.ChronoLocalDate;
    75 import java.time.chrono.ChronoLocalDate;
    76 import java.time.chrono.Chronology;
    76 import java.time.chrono.Chronology;
    77 import java.time.format.DateTimeParseException;
    77 import java.time.format.DateTimeParseException;
    78 import java.time.temporal.ChronoUnit;
    78 import java.time.temporal.ChronoUnit;
   991 
   991 
   992     //-----------------------------------------------------------------------
   992     //-----------------------------------------------------------------------
   993     /**
   993     /**
   994      * Writes the object using a
   994      * Writes the object using a
   995      * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
   995      * <a href="../../serialized-form.html#java.time.Ser">dedicated serialized form</a>.
       
   996      * @serialData
   996      * <pre>
   997      * <pre>
   997      *  out.writeByte(14);  // identifies this as a Period
   998      *  out.writeByte(14);  // identifies a Period
   998      *  out.writeInt(years);
   999      *  out.writeInt(years);
   999      *  out.writeInt(months);
  1000      *  out.writeInt(months);
  1000      *  out.writeInt(seconds);
  1001      *  out.writeInt(days);
  1001      * </pre>
  1002      * </pre>
  1002      *
  1003      *
  1003      * @return the instance of {@code Ser}, not null
  1004      * @return the instance of {@code Ser}, not null
  1004      */
  1005      */
  1005     private Object writeReplace() {
  1006     private Object writeReplace() {
  1009     /**
  1010     /**
  1010      * Defend against malicious streams.
  1011      * Defend against malicious streams.
  1011      * @return never
  1012      * @return never
  1012      * @throws java.io.InvalidObjectException always
  1013      * @throws java.io.InvalidObjectException always
  1013      */
  1014      */
  1014     private Object readResolve() throws ObjectStreamException {
  1015     private Object readResolve() throws InvalidObjectException {
  1015         throw new InvalidObjectException("Deserialization via serialization delegate");
  1016         throw new InvalidObjectException("Deserialization via serialization delegate");
  1016     }
  1017     }
  1017 
  1018 
  1018     void writeExternal(DataOutput out) throws IOException {
  1019     void writeExternal(DataOutput out) throws IOException {
  1019         out.writeInt(years);
  1020         out.writeInt(years);