Java InputStream Class
InputStream is an abstract class and also the superclass of all classes representing an input stream of bytes.
InputStream has this declaration:
public abstract class InputStream extends Object implements Closeable
- public int available() throws IOException
- It will return the number of bytes available that can be read or skipped over from this input stream without blocking. Returns 0 when it reaches the end of the input stream.
- public void close() throws IOException
Closes this input stream and releases any system resources associated with the stream. Further read attempts will generate an
- public abstract int read() throws IOException
- Returns an integer representation (in the range 0 to 255) of the next available byte of input. Returns -1 if the end of the stream is reached.
- public int read(byte b) throws IOException
It tries to read bytes (up to b.length bytes) into
band returns the actual number of bytes that were successfully read. Returns -1 if the end of the file is reached.
- public int read(byte b, int offset, int num) throws IOException
It tries to read bytes (up to
b[offset]and returns the actual number of bytes that were successfully read. Returns -1 if the end of the file is reached.
- public long skip(long n) throws IOException
nbytes of input, returning the number of bytes actually ignored.
- public void mark(int limit)
Marks the current position in this input stream. Returns
limit, the maximum limit of bytes that can be read before the mark position becomes invalid.
- public void reset() throws IOException
Resets this stream to the previously set mark. Throws
IOExceptionif this stream has not been marked or if the mark has been invalidated.
- public boolean markSupported()
trueif mark() or reset() are supported by the this stream.