180 * </ul>
181 * <p>
182 * If {@code b} is {@code null},
183 * a {@code NullPointerException} is thrown.
184 * If {@code b.length} is zero, then
185 * no bytes are read. Otherwise, the first
186 * byte read is stored into element {@code b[0]},
187 * the next one into {@code b[1]}, and
188 * so on.
189 * If an exception is thrown from
190 * this method, then it may be that some but
191 * not all bytes of {@code b} have been
192 * updated with data from the input stream.
193 *
194 * @param b the buffer into which the data is read.
195 * @throws NullPointerException if {@code b} is {@code null}.
196 * @throws EOFException if this stream reaches the end before reading
197 * all the bytes.
198 * @throws IOException if an I/O error occurs.
199 */
200 void readFully(byte b[]) throws IOException;
201
202 /**
203 *
204 * Reads {@code len}
205 * bytes from
206 * an input stream.
207 * <p>
208 * This method
209 * blocks until one of the following conditions
210 * occurs:
211 * <ul>
212 * <li>{@code len} bytes
213 * of input data are available, in which case
214 * a normal return is made.
215 *
216 * <li>End of file
217 * is detected, in which case an {@code EOFException}
218 * is thrown.
219 *
220 * <li>An I/O error occurs, in
230 * then an {@code IndexOutOfBoundsException}
231 * is thrown.
232 * If {@code len} is zero,
233 * then no bytes are read. Otherwise, the first
234 * byte read is stored into element {@code b[off]},
235 * the next one into {@code b[off+1]},
236 * and so on. The number of bytes read is,
237 * at most, equal to {@code len}.
238 *
239 * @param b the buffer into which the data is read.
240 * @param off an int specifying the offset in the data array {@code b}.
241 * @param len an int specifying the number of bytes to read.
242 * @throws NullPointerException if {@code b} is {@code null}.
243 * @throws IndexOutOfBoundsException if {@code off} is negative,
244 * {@code len} is negative, or {@code len} is greater than
245 * {@code b.length - off}.
246 * @throws EOFException if this stream reaches the end before reading
247 * all the bytes.
248 * @throws IOException if an I/O error occurs.
249 */
250 void readFully(byte b[], int off, int len) throws IOException;
251
252 /**
253 * Makes an attempt to skip over
254 * {@code n} bytes
255 * of data from the input
256 * stream, discarding the skipped bytes. However,
257 * it may skip
258 * over some smaller number of
259 * bytes, possibly zero. This may result from
260 * any of a
261 * number of conditions; reaching
262 * end of file before {@code n} bytes
263 * have been skipped is
264 * only one possibility.
265 * This method never throws an {@code EOFException}.
266 * The actual
267 * number of bytes skipped is returned.
268 *
269 * @param n the number of bytes to be skipped.
270 * @return the number of bytes actually skipped.
|
180 * </ul>
181 * <p>
182 * If {@code b} is {@code null},
183 * a {@code NullPointerException} is thrown.
184 * If {@code b.length} is zero, then
185 * no bytes are read. Otherwise, the first
186 * byte read is stored into element {@code b[0]},
187 * the next one into {@code b[1]}, and
188 * so on.
189 * If an exception is thrown from
190 * this method, then it may be that some but
191 * not all bytes of {@code b} have been
192 * updated with data from the input stream.
193 *
194 * @param b the buffer into which the data is read.
195 * @throws NullPointerException if {@code b} is {@code null}.
196 * @throws EOFException if this stream reaches the end before reading
197 * all the bytes.
198 * @throws IOException if an I/O error occurs.
199 */
200 void readFully(byte[] b) throws IOException;
201
202 /**
203 *
204 * Reads {@code len}
205 * bytes from
206 * an input stream.
207 * <p>
208 * This method
209 * blocks until one of the following conditions
210 * occurs:
211 * <ul>
212 * <li>{@code len} bytes
213 * of input data are available, in which case
214 * a normal return is made.
215 *
216 * <li>End of file
217 * is detected, in which case an {@code EOFException}
218 * is thrown.
219 *
220 * <li>An I/O error occurs, in
230 * then an {@code IndexOutOfBoundsException}
231 * is thrown.
232 * If {@code len} is zero,
233 * then no bytes are read. Otherwise, the first
234 * byte read is stored into element {@code b[off]},
235 * the next one into {@code b[off+1]},
236 * and so on. The number of bytes read is,
237 * at most, equal to {@code len}.
238 *
239 * @param b the buffer into which the data is read.
240 * @param off an int specifying the offset in the data array {@code b}.
241 * @param len an int specifying the number of bytes to read.
242 * @throws NullPointerException if {@code b} is {@code null}.
243 * @throws IndexOutOfBoundsException if {@code off} is negative,
244 * {@code len} is negative, or {@code len} is greater than
245 * {@code b.length - off}.
246 * @throws EOFException if this stream reaches the end before reading
247 * all the bytes.
248 * @throws IOException if an I/O error occurs.
249 */
250 void readFully(byte[] b, int off, int len) throws IOException;
251
252 /**
253 * Makes an attempt to skip over
254 * {@code n} bytes
255 * of data from the input
256 * stream, discarding the skipped bytes. However,
257 * it may skip
258 * over some smaller number of
259 * bytes, possibly zero. This may result from
260 * any of a
261 * number of conditions; reaching
262 * end of file before {@code n} bytes
263 * have been skipped is
264 * only one possibility.
265 * This method never throws an {@code EOFException}.
266 * The actual
267 * number of bytes skipped is returned.
268 *
269 * @param n the number of bytes to be skipped.
270 * @return the number of bytes actually skipped.
|