src/java.base/share/classes/java/io/Externalizable.java
changeset 58242 94bb65cb37d3
parent 47216 71c04702a3d5
equal deleted inserted replaced
58241:33de7752835c 58242:94bb65cb37d3
     1 /*
     1 /*
     2  * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    74      *             the data layout of this Externalizable object.
    74      *             the data layout of this Externalizable object.
    75      *             List the sequence of element types and, if possible,
    75      *             List the sequence of element types and, if possible,
    76      *             relate the element to a public/protected field and/or
    76      *             relate the element to a public/protected field and/or
    77      *             method of this Externalizable class.
    77      *             method of this Externalizable class.
    78      *
    78      *
    79      * @param out the stream to write the object to
    79      * @param     out the stream to write the object to
    80      * @exception IOException Includes any I/O exceptions that may occur
    80      * @throws    IOException Includes any I/O exceptions that may occur
    81      */
    81      */
    82     void writeExternal(ObjectOutput out) throws IOException;
    82     void writeExternal(ObjectOutput out) throws IOException;
    83 
    83 
    84     /**
    84     /**
    85      * The object implements the readExternal method to restore its
    85      * The object implements the readExternal method to restore its
    86      * contents by calling the methods of DataInput for primitive
    86      * contents by calling the methods of DataInput for primitive
    87      * types and readObject for objects, strings and arrays.  The
    87      * types and readObject for objects, strings and arrays.  The
    88      * readExternal method must read the values in the same sequence
    88      * readExternal method must read the values in the same sequence
    89      * and with the same types as were written by writeExternal.
    89      * and with the same types as were written by writeExternal.
    90      *
    90      *
    91      * @param in the stream to read data from in order to restore the object
    91      * @param     in the stream to read data from in order to restore the object
    92      * @exception IOException if I/O errors occur
    92      * @throws    IOException if I/O errors occur
    93      * @exception ClassNotFoundException If the class for an object being
    93      * @throws    ClassNotFoundException If the class for an object being
    94      *              restored cannot be found.
    94      *            restored cannot be found.
    95      */
    95      */
    96     void readExternal(ObjectInput in) throws IOException, ClassNotFoundException;
    96     void readExternal(ObjectInput in) throws IOException, ClassNotFoundException;
    97 }
    97 }