KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > io > ObjectInput


1 /*
2  * @(#)ObjectInput.java 1.19 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.io;
9
10 /**
11  * ObjectInput extends the DataInput interface to include the reading of
12  * objects. DataInput includes methods for the input of primitive types,
13  * ObjectInput extends that interface to include objects, arrays, and Strings.
14  *
15  * @author unascribed
16  * @version 1.19, 12/19/03
17  * @see java.io.InputStream
18  * @see java.io.ObjectOutputStream
19  * @see java.io.ObjectInputStream
20  * @since JDK1.1
21  */

22 public interface ObjectInput extends DataInput JavaDoc {
23     /**
24      * Read and return an object. The class that implements this interface
25      * defines where the object is "read" from.
26      *
27      * @return the object read from the stream
28      * @exception java.lang.ClassNotFoundException If the class of a serialized
29      * object cannot be found.
30      * @exception IOException If any of the usual Input/Output
31      * related exceptions occur.
32      */

33     public Object JavaDoc readObject()
34     throws ClassNotFoundException JavaDoc, IOException JavaDoc;
35
36     /**
37      * Reads a byte of data. This method will block if no input is
38      * available.
39      * @return the byte read, or -1 if the end of the
40      * stream is reached.
41      * @exception IOException If an I/O error has occurred.
42      */

43     public int read() throws IOException JavaDoc;
44
45     /**
46      * Reads into an array of bytes. This method will
47      * block until some input is available.
48      * @param b the buffer into which the data is read
49      * @return the actual number of bytes read, -1 is
50      * returned when the end of the stream is reached.
51      * @exception IOException If an I/O error has occurred.
52      */

53     public int read(byte b[]) throws IOException JavaDoc;
54
55     /**
56      * Reads into an array of bytes. This method will
57      * block until some input is available.
58      * @param b the buffer into which the data is read
59      * @param off the start offset of the data
60      * @param len the maximum number of bytes read
61      * @return the actual number of bytes read, -1 is
62      * returned when the end of the stream is reached.
63      * @exception IOException If an I/O error has occurred.
64      */

65     public int read(byte b[], int off, int len) throws IOException JavaDoc;
66
67     /**
68      * Skips n bytes of input.
69      * @param n the number of bytes to be skipped
70      * @return the actual number of bytes skipped.
71      * @exception IOException If an I/O error has occurred.
72      */

73     public long skip(long n) throws IOException JavaDoc;
74
75     /**
76      * Returns the number of bytes that can be read
77      * without blocking.
78      * @return the number of available bytes.
79      * @exception IOException If an I/O error has occurred.
80      */

81     public int available() throws IOException JavaDoc;
82
83     /**
84      * Closes the input stream. Must be called
85      * to release any resources associated with
86      * the stream.
87      * @exception IOException If an I/O error has occurred.
88      */

89     public void close() throws IOException JavaDoc;
90 }
91
Popular Tags