jaroslav@601: /* jaroslav@601: * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. jaroslav@601: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. jaroslav@601: * jaroslav@601: * This code is free software; you can redistribute it and/or modify it jaroslav@601: * under the terms of the GNU General Public License version 2 only, as jaroslav@601: * published by the Free Software Foundation. Oracle designates this jaroslav@601: * particular file as subject to the "Classpath" exception as provided jaroslav@601: * by Oracle in the LICENSE file that accompanied this code. jaroslav@601: * jaroslav@601: * This code is distributed in the hope that it will be useful, but WITHOUT jaroslav@601: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or jaroslav@601: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License jaroslav@601: * version 2 for more details (a copy is included in the LICENSE file that jaroslav@601: * accompanied this code). jaroslav@601: * jaroslav@601: * You should have received a copy of the GNU General Public License version jaroslav@601: * 2 along with this work; if not, write to the Free Software Foundation, jaroslav@601: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. jaroslav@601: * jaroslav@601: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA jaroslav@601: * or visit www.oracle.com if you need additional information or have any jaroslav@601: * questions. jaroslav@601: */ jaroslav@601: jaroslav@601: package java.io; jaroslav@601: jaroslav@601: /** jaroslav@601: * ObjectOutput extends the DataOutput interface to include writing of objects. jaroslav@601: * DataOutput includes methods for output of primitive types, ObjectOutput jaroslav@601: * extends that interface to include objects, arrays, and Strings. jaroslav@601: * jaroslav@601: * @author unascribed jaroslav@601: * @see java.io.InputStream jaroslav@601: * @see java.io.ObjectOutputStream jaroslav@601: * @see java.io.ObjectInputStream jaroslav@601: * @since JDK1.1 jaroslav@601: */ jaroslav@601: public interface ObjectOutput extends DataOutput, AutoCloseable { jaroslav@601: /** jaroslav@601: * Write an object to the underlying storage or stream. The jaroslav@601: * class that implements this interface defines how the object is jaroslav@601: * written. jaroslav@601: * jaroslav@601: * @param obj the object to be written jaroslav@601: * @exception IOException Any of the usual Input/Output related exceptions. jaroslav@601: */ jaroslav@601: public void writeObject(Object obj) jaroslav@601: throws IOException; jaroslav@601: jaroslav@601: /** jaroslav@601: * Writes a byte. This method will block until the byte is actually jaroslav@601: * written. jaroslav@601: * @param b the byte jaroslav@601: * @exception IOException If an I/O error has occurred. jaroslav@601: */ jaroslav@601: public void write(int b) throws IOException; jaroslav@601: jaroslav@601: /** jaroslav@601: * Writes an array of bytes. This method will block until the bytes jaroslav@601: * are actually written. jaroslav@601: * @param b the data to be written jaroslav@601: * @exception IOException If an I/O error has occurred. jaroslav@601: */ jaroslav@601: public void write(byte b[]) throws IOException; jaroslav@601: jaroslav@601: /** jaroslav@601: * Writes a sub array of bytes. jaroslav@601: * @param b the data to be written jaroslav@601: * @param off the start offset in the data jaroslav@601: * @param len the number of bytes that are written jaroslav@601: * @exception IOException If an I/O error has occurred. jaroslav@601: */ jaroslav@601: public void write(byte b[], int off, int len) throws IOException; jaroslav@601: jaroslav@601: /** jaroslav@601: * Flushes the stream. This will write any buffered jaroslav@601: * output bytes. jaroslav@601: * @exception IOException If an I/O error has occurred. jaroslav@601: */ jaroslav@601: public void flush() throws IOException; jaroslav@601: jaroslav@601: /** jaroslav@601: * Closes the stream. This method must be called jaroslav@601: * to release any resources associated with the jaroslav@601: * stream. jaroslav@601: * @exception IOException If an I/O error has occurred. jaroslav@601: */ jaroslav@601: public void close() throws IOException; jaroslav@601: }