22.3
java.io.InputStream
THE PACKAGE JAVA.IO
22.3 The Class
java.io.InputStream
An input stream makes input bytes available from some source.
public abstract class InputStream {
public abstract int read() throws IOException;
public int read(byte[] b)
throws IOException, NullPointerException;
public int read(byte[] b, int off, int len)
throws IOException, NullPointerException,
IndexOutOfBoundsException;
public long skip(long n) throws IOException;
public int available() throws IOException;
public void close() throws IOException;
public void mark(int readlimit);
public void reset() throws IOException;
public boolean markSupported();
}
22.3.1
public abstract int read() throws IOException
The general contract of
read
is that it reads one byte from the input stream. The
byte is returned as an integer in the range
0
to
255
(
0x00
0xff
). If no byte is
available because the stream is at end of file, the value
1
is returned.
This method blocks until input data is available, end of file is detected, or an
exception is thrown.
If the byte cannot be read for any reason other than end of file, an
IOExcep
tion
is thrown. In particular, an
IOException
is thrown if the input stream has
been closed ( 22.3.6).
22.3.2
public int read(byte[] b)
throws IOException, NullPointerException
The general contract of
read(b)
is that it reads some number of bytes from the
input stream and stores them into the buffer array
b
. The number of bytes actually
read is returned as an integer.
This method blocks until input data is available, end of file is detected, or an
exception is thrown.
If
b
is
null
, a
NullPointerException
is thrown.
If the length of
b
is zero, then no bytes are read and
0
is returned; otherwise,
there is an attempt to read at least one byte. If no byte is available because the
680
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved