jdk/src/share/classes/java/time/zone/ZoneOffsetTransition.java
changeset 19841 15c8e97d6a14
parent 17474 8c100beabcc0
child 21331 8ee181e7e48b
equal deleted inserted replaced
19822:4e10a58fa28f 19841:15c8e97d6a14
    62 package java.time.zone;
    62 package java.time.zone;
    63 
    63 
    64 import java.io.DataInput;
    64 import java.io.DataInput;
    65 import java.io.DataOutput;
    65 import java.io.DataOutput;
    66 import java.io.IOException;
    66 import java.io.IOException;
       
    67 import java.io.InvalidObjectException;
    67 import java.io.Serializable;
    68 import java.io.Serializable;
    68 import java.time.Duration;
    69 import java.time.Duration;
    69 import java.time.Instant;
    70 import java.time.Instant;
    70 import java.time.LocalDateTime;
    71 import java.time.LocalDateTime;
    71 import java.time.ZoneOffset;
    72 import java.time.ZoneOffset;
   168         this.offsetAfter = offsetAfter;
   169         this.offsetAfter = offsetAfter;
   169     }
   170     }
   170 
   171 
   171     //-----------------------------------------------------------------------
   172     //-----------------------------------------------------------------------
   172     /**
   173     /**
   173      * Uses a serialization delegate.
   174      * Defend against malicious streams.
   174      *
   175      * @return never
       
   176      * @throws InvalidObjectException always
       
   177      */
       
   178     private Object readResolve() throws InvalidObjectException {
       
   179         throw new InvalidObjectException("Deserialization via serialization delegate");
       
   180     }
       
   181 
       
   182     /**
       
   183      * Writes the object using a
       
   184      * <a href="../../../serialized-form.html#java.time.zone.Ser">dedicated serialized form</a>.
       
   185      * @serialData
       
   186      * Refer to the serialized form of
       
   187      * <a href="../../../serialized-form.html#java.time.zone.ZoneRules">ZoneRules.writeReplace</a>
       
   188      * for the encoding of epoch seconds and offsets.
       
   189      * <pre style="font-size:1.0em">{@code
       
   190      *
       
   191      *   out.writeByte(2);                // identifies a ZoneOffsetTransition
       
   192      *   out.writeEpochSec(toEpochSecond);
       
   193      *   out.writeOffset(offsetBefore);
       
   194      *   out.writeOfset(offsetAfter);
       
   195      * }
       
   196      * </pre>
   175      * @return the replacing object, not null
   197      * @return the replacing object, not null
   176      */
   198      */
   177     private Object writeReplace() {
   199     private Object writeReplace() {
   178         return new Ser(Ser.ZOT, this);
   200         return new Ser(Ser.ZOT, this);
   179     }
   201     }