java.io · java.base · since Java 1.0

InputStream

declaration
public abstract class InputStream implements Closeable

The abstract byte source: read() returns 0–255 or −1 at end. Everything binary flows through it, usually wrapped in a BufferedInputStream.

Key methods

int read()One byte (as int) or −1 at end of stream.
int read(byte[] b)May fill FEWER bytes than requested — loop or use readNBytes.
byte[] readAllBytes()Slurp the rest (small payloads).
long transferTo(OutputStream out)Pipe everything downstream (Java 9).
static InputStream nullInputStream()An empty stream for tests/defaults.