java.io.InputStream
is an abstract class that contains the basic
methods for reading raw bytes of data from a stream. Although InputStream
is an abstract class many methods in the class library
are only specified to return an InputStream
, so you'll often have to deal directly with only the methods declared in this class.
public abstract int read() throws IOException
public int read(byte[] data) throws IOException
public int read(byte[] data, int offset, int length) throws IOException
public long skip(long n) throws IOException
public int available() throws IOException
public void close() throws IOException
public synchronized void mark(int readlimit)
public synchronized void reset() throws IOException
public boolean markSupported()
Notice that almost all these methods can throw an IOException
. This is true of pretty much anything to do with input and output. The only exception is the PrintStream
class which eats all exceptions.