1 |
/* ObjectInput.java -- Read object data from a stream |
/* ObjectInput.java -- Read object data from a stream |
2 |
Copyright (C) 1998 Free Software Foundation, Inc. |
Copyright (C) 1998,2003 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
44 |
* also has methods that allow input to be done in a manner similar to |
* also has methods that allow input to be done in a manner similar to |
45 |
* <code>InputStream</code> |
* <code>InputStream</code> |
46 |
* |
* |
|
* @version 0.0 |
|
|
* |
|
47 |
* @author Aaron M. Renn (arenn@urbanophile.com) |
* @author Aaron M. Renn (arenn@urbanophile.com) |
48 |
*/ |
*/ |
49 |
public interface ObjectInput extends DataInput |
public interface ObjectInput extends DataInput |
50 |
{ |
{ |
51 |
|
/** |
52 |
/** |
* This method returns the number of bytes that can be read without |
53 |
* This method returns the number of bytes that can be read without |
* blocking. |
54 |
* blocking. |
* |
55 |
* |
* @return The number of bytes available before blocking |
56 |
* @return The number of bytes available before blocking |
* |
57 |
* |
* @exception IOException If an error occurs |
58 |
* @exception IOException If an error occurs |
*/ |
59 |
*/ |
public abstract int available() throws IOException; |
60 |
public abstract int |
|
61 |
available() throws IOException; |
/*************************************************************************/ |
62 |
|
|
63 |
/*************************************************************************/ |
/** |
64 |
|
* This method reading a byte of data from a stream. It returns that byte |
65 |
/** |
* as an int. This method blocks if no data is available to be read. |
66 |
* This method reading a byte of data from a stream. It returns that byte |
* |
67 |
* as an int. This method blocks if no data is available to be read. |
* @return The byte of data read |
68 |
* |
* |
69 |
* @return The byte of data read |
* @exception IOException If an error occurs |
70 |
* |
*/ |
71 |
* @exception IOException If an error occurs |
public abstract int read() throws IOException; |
72 |
*/ |
|
73 |
public abstract int |
/*************************************************************************/ |
74 |
read() throws IOException; |
|
75 |
|
/** |
76 |
/*************************************************************************/ |
* This method reads raw bytes and stores them them a byte array buffer. |
77 |
|
* Note that this method will block if no data is available. However, |
78 |
/** |
* it will not necessarily block until it fills the entire buffer. That is, |
79 |
* This method reads raw bytes and stores them them a byte array buffer. |
* a "short count" is possible. |
80 |
* Note that this method will block if no data is available. However, |
* |
81 |
* it will not necessarily block until it fills the entire buffer. That is, |
* @param buf The byte array to receive the data read |
82 |
* a "short count" is possible. |
* |
83 |
* |
* @return The actual number fo bytes read or -1 if end of stream |
84 |
* @param buf The byte array to receive the data read |
* |
85 |
* |
* @exception IOException If an error occurs |
86 |
* @return The actual number fo bytes read or -1 if end of stream |
*/ |
87 |
* |
public abstract int read(byte[] buf) throws IOException; |
88 |
* @exception IOException If an error occurs |
|
89 |
*/ |
/*************************************************************************/ |
90 |
public abstract int |
|
91 |
read(byte[] buf) throws IOException; |
/** |
92 |
|
* This method reads raw bytes and stores them in a byte array buffer |
93 |
/*************************************************************************/ |
* <code>buf</code> starting at position <code>offset</code> into the |
94 |
|
* buffer. A |
95 |
/** |
* maximum of <code>len</code> bytes will be read. Note that this method |
96 |
* This method reads raw bytes and stores them in a byte array buffer |
* blocks if no data is available, but will not necessarily block until |
97 |
* <code>buf</code> starting at position <code>offset</code> into the buffer. A |
* it can read <code>len</code> bytes of data. That is, a "short count" is |
98 |
* maximum of <code>len</code> bytes will be read. Note that this method |
* possible. |
99 |
* blocks if no data is available, but will not necessarily block until |
* |
100 |
* it can read <code>len</code> bytes of data. That is, a "short count" is |
* @param buf The byte array to receive the data read |
101 |
* possible. |
* @param offset The offset into @code{buf} to start storing data |
102 |
* |
* @param len The maximum number of bytes to read |
103 |
* @param buf The byte array to receive the data read |
* |
104 |
* @param offset The offset into @code{buf} to start storing data |
* @return The actual number fo bytes read or -1 if end of stream |
105 |
* @param len The maximum number of bytes to read |
* |
106 |
* |
* @exception IOException If an error occurs |
107 |
* @return The actual number fo bytes read or -1 if end of stream |
*/ |
108 |
* |
public abstract int read(byte[] buf, int offset, int len) throws IOException; |
109 |
* @exception IOException If an error occurs |
|
110 |
*/ |
/*************************************************************************/ |
111 |
public abstract int |
|
112 |
read(byte[] buf, int offset, int len) throws IOException; |
/** |
113 |
|
* Reads an object instance and returns it. If the class for the object |
114 |
/*************************************************************************/ |
* being read cannot be found, then a ClassNotFoundException will |
115 |
|
* be thrown. |
116 |
/** |
* |
117 |
* Reads an object instance and returns it. If the class for the object |
* @return The object instance that was read |
118 |
* being read cannot be found, then a ClassNotFoundException will |
* |
119 |
* be thrown. |
* @exception ClassNotFoundException If a class for the object cannot be |
120 |
* |
* found |
121 |
* @return The object instance that was read |
* @exception IOException If an error occurs |
122 |
* |
*/ |
123 |
* @exception ClassNotFoundException If a class for the object cannot be found |
public abstract Object readObject() |
124 |
* @exception IOException If an error occurs |
throws ClassNotFoundException, IOException; |
125 |
*/ |
|
126 |
public abstract Object |
/*************************************************************************/ |
127 |
readObject() throws ClassNotFoundException, IOException; |
|
128 |
|
/** |
129 |
/*************************************************************************/ |
* This method causes the specified number of bytes to be read and |
130 |
|
* discarded. It is possible that fewer than the requested number of bytes |
131 |
/** |
* will actually be skipped. |
132 |
* This method causes the specified number of bytes to be read and |
* |
133 |
* discarded. It is possible that fewer than the requested number of bytes |
* @param numBytes The number of bytes to skip |
134 |
* will actually be skipped. |
* |
135 |
* |
* @return The actual number of bytes skipped |
136 |
* @param num_bytes The number of bytes to skip |
* |
137 |
* |
* @exception IOException If an error occurs |
138 |
* @return The actual number of bytes skipped |
*/ |
139 |
* |
public abstract long skip(long num_bytes) throws IOException; |
140 |
* @exception IOException If an error occurs |
|
141 |
*/ |
/*************************************************************************/ |
142 |
public abstract long |
|
143 |
skip(long num_bytes) throws IOException; |
/** |
144 |
|
* This method closes the input source |
145 |
/*************************************************************************/ |
* |
146 |
|
* @exception IOException If an error occurs |
147 |
/** |
*/ |
148 |
* This method closes the input source |
public abstract void close() throws IOException; |
|
* |
|
|
* @exception IOException If an error occurs |
|
|
*/ |
|
|
public abstract void |
|
|
close() throws IOException; |
|
149 |
|
|
150 |
} // interface ObjectInput |
} // interface ObjectInput |
151 |
|
|