1 /*
2 * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
60 * @see java.io.ObjectInputStream
61 * @see java.io.ObjectOutput
62 * @see java.io.ObjectInput
63 * @see java.io.Serializable
64 * @since 1.1
65 */
66 public interface Externalizable extends java.io.Serializable {
67 /**
68 * The object implements the writeExternal method to save its contents
69 * by calling the methods of DataOutput for its primitive values or
70 * calling the writeObject method of ObjectOutput for objects, strings,
71 * and arrays.
72 *
73 * @serialData Overriding methods should use this tag to describe
74 * the data layout of this Externalizable object.
75 * List the sequence of element types and, if possible,
76 * relate the element to a public/protected field and/or
77 * method of this Externalizable class.
78 *
79 * @param out the stream to write the object to
80 * @exception IOException Includes any I/O exceptions that may occur
81 */
82 void writeExternal(ObjectOutput out) throws IOException;
83
84 /**
85 * The object implements the readExternal method to restore its
86 * contents by calling the methods of DataInput for primitive
87 * types and readObject for objects, strings and arrays. The
88 * readExternal method must read the values in the same sequence
89 * and with the same types as were written by writeExternal.
90 *
91 * @param in the stream to read data from in order to restore the object
92 * @exception IOException if I/O errors occur
93 * @exception ClassNotFoundException If the class for an object being
94 * restored cannot be found.
95 */
96 void readExternal(ObjectInput in) throws IOException, ClassNotFoundException;
97 }
|
1 /*
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.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
60 * @see java.io.ObjectInputStream
61 * @see java.io.ObjectOutput
62 * @see java.io.ObjectInput
63 * @see java.io.Serializable
64 * @since 1.1
65 */
66 public interface Externalizable extends java.io.Serializable {
67 /**
68 * The object implements the writeExternal method to save its contents
69 * by calling the methods of DataOutput for its primitive values or
70 * calling the writeObject method of ObjectOutput for objects, strings,
71 * and arrays.
72 *
73 * @serialData Overriding methods should use this tag to describe
74 * the data layout of this Externalizable object.
75 * List the sequence of element types and, if possible,
76 * relate the element to a public/protected field and/or
77 * method of this Externalizable class.
78 *
79 * @param out the stream to write the object to
80 * @throws IOException Includes any I/O exceptions that may occur
81 */
82 void writeExternal(ObjectOutput out) throws IOException;
83
84 /**
85 * The object implements the readExternal method to restore its
86 * contents by calling the methods of DataInput for primitive
87 * types and readObject for objects, strings and arrays. The
88 * readExternal method must read the values in the same sequence
89 * and with the same types as were written by writeExternal.
90 *
91 * @param in the stream to read data from in order to restore the object
92 * @throws IOException if I/O errors occur
93 * @throws ClassNotFoundException If the class for an object being
94 * restored cannot be found.
95 */
96 void readExternal(ObjectInput in) throws IOException, ClassNotFoundException;
97 }
|