The InputStream Class

The InputStream class is an abstract class that lays the foundation for the Java byte-input class hierarchy. As such, it provides methods that all InputStream classes inherit.

The read() Method

The read() method is the most important method of the InputStream class hierarchy. It reads a byte of data from an input stream and blocks if no data is available. When a method blocks, it causes the thread in which it is executing to wait until data becomes available. This is not a problem in multithreaded programs. The read() method takes on several overloaded forms. It can read a single byte or an array of bytes, depending on what form is used. If it reads a single byte, it returns the byte that is read. If it reads an array of ...

Get Sun Certification Training Guide (310-025, 310-027): Java™ 2 Programmer and Developer Exams now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.