1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/rt/emul/compact/src/main/java/java/io/ObjectInput.java Tue Feb 26 16:54:16 2013 +0100
1.3 @@ -0,0 +1,107 @@
1.4 +/*
1.5 + * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1.7 + *
1.8 + * This code is free software; you can redistribute it and/or modify it
1.9 + * under the terms of the GNU General Public License version 2 only, as
1.10 + * published by the Free Software Foundation. Oracle designates this
1.11 + * particular file as subject to the "Classpath" exception as provided
1.12 + * by Oracle in the LICENSE file that accompanied this code.
1.13 + *
1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1.17 + * version 2 for more details (a copy is included in the LICENSE file that
1.18 + * accompanied this code).
1.19 + *
1.20 + * You should have received a copy of the GNU General Public License version
1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1.23 + *
1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1.25 + * or visit www.oracle.com if you need additional information or have any
1.26 + * questions.
1.27 + */
1.28 +
1.29 +package java.io;
1.30 +
1.31 +/**
1.32 + * ObjectInput extends the DataInput interface to include the reading of
1.33 + * objects. DataInput includes methods for the input of primitive types,
1.34 + * ObjectInput extends that interface to include objects, arrays, and Strings.
1.35 + *
1.36 + * @author unascribed
1.37 + * @see java.io.InputStream
1.38 + * @see java.io.ObjectOutputStream
1.39 + * @see java.io.ObjectInputStream
1.40 + * @since JDK1.1
1.41 + */
1.42 +public interface ObjectInput extends DataInput, AutoCloseable {
1.43 + /**
1.44 + * Read and return an object. The class that implements this interface
1.45 + * defines where the object is "read" from.
1.46 + *
1.47 + * @return the object read from the stream
1.48 + * @exception java.lang.ClassNotFoundException If the class of a serialized
1.49 + * object cannot be found.
1.50 + * @exception IOException If any of the usual Input/Output
1.51 + * related exceptions occur.
1.52 + */
1.53 + public Object readObject()
1.54 + throws ClassNotFoundException, IOException;
1.55 +
1.56 + /**
1.57 + * Reads a byte of data. This method will block if no input is
1.58 + * available.
1.59 + * @return the byte read, or -1 if the end of the
1.60 + * stream is reached.
1.61 + * @exception IOException If an I/O error has occurred.
1.62 + */
1.63 + public int read() throws IOException;
1.64 +
1.65 + /**
1.66 + * Reads into an array of bytes. This method will
1.67 + * block until some input is available.
1.68 + * @param b the buffer into which the data is read
1.69 + * @return the actual number of bytes read, -1 is
1.70 + * returned when the end of the stream is reached.
1.71 + * @exception IOException If an I/O error has occurred.
1.72 + */
1.73 + public int read(byte b[]) throws IOException;
1.74 +
1.75 + /**
1.76 + * Reads into an array of bytes. This method will
1.77 + * block until some input is available.
1.78 + * @param b the buffer into which the data is read
1.79 + * @param off the start offset of the data
1.80 + * @param len the maximum number of bytes read
1.81 + * @return the actual number of bytes read, -1 is
1.82 + * returned when the end of the stream is reached.
1.83 + * @exception IOException If an I/O error has occurred.
1.84 + */
1.85 + public int read(byte b[], int off, int len) throws IOException;
1.86 +
1.87 + /**
1.88 + * Skips n bytes of input.
1.89 + * @param n the number of bytes to be skipped
1.90 + * @return the actual number of bytes skipped.
1.91 + * @exception IOException If an I/O error has occurred.
1.92 + */
1.93 + public long skip(long n) throws IOException;
1.94 +
1.95 + /**
1.96 + * Returns the number of bytes that can be read
1.97 + * without blocking.
1.98 + * @return the number of available bytes.
1.99 + * @exception IOException If an I/O error has occurred.
1.100 + */
1.101 + public int available() throws IOException;
1.102 +
1.103 + /**
1.104 + * Closes the input stream. Must be called
1.105 + * to release any resources associated with
1.106 + * the stream.
1.107 + * @exception IOException If an I/O error has occurred.
1.108 + */
1.109 + public void close() throws IOException;
1.110 +}