Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/io/ObjectOutput.java
38829 views
/*1* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.io;2627/**28* ObjectOutput extends the DataOutput interface to include writing of objects.29* DataOutput includes methods for output of primitive types, ObjectOutput30* extends that interface to include objects, arrays, and Strings.31*32* @author unascribed33* @see java.io.InputStream34* @see java.io.ObjectOutputStream35* @see java.io.ObjectInputStream36* @since JDK1.137*/38public interface ObjectOutput extends DataOutput, AutoCloseable {39/**40* Write an object to the underlying storage or stream. The41* class that implements this interface defines how the object is42* written.43*44* @param obj the object to be written45* @exception IOException Any of the usual Input/Output related exceptions.46*/47public void writeObject(Object obj)48throws IOException;4950/**51* Writes a byte. This method will block until the byte is actually52* written.53* @param b the byte54* @exception IOException If an I/O error has occurred.55*/56public void write(int b) throws IOException;5758/**59* Writes an array of bytes. This method will block until the bytes60* are actually written.61* @param b the data to be written62* @exception IOException If an I/O error has occurred.63*/64public void write(byte b[]) throws IOException;6566/**67* Writes a sub array of bytes.68* @param b the data to be written69* @param off the start offset in the data70* @param len the number of bytes that are written71* @exception IOException If an I/O error has occurred.72*/73public void write(byte b[], int off, int len) throws IOException;7475/**76* Flushes the stream. This will write any buffered77* output bytes.78* @exception IOException If an I/O error has occurred.79*/80public void flush() throws IOException;8182/**83* Closes the stream. This method must be called84* to release any resources associated with the85* stream.86* @exception IOException If an I/O error has occurred.87*/88public void close() throws IOException;89}909192