Streams
As we have seen, once a connection is established with the remote machine, data gets exchanged in the form of binary streams. To access binary data, the java.io package provides two basic types of classes: one for incoming and other for outgoing data, namely java.io.InputStream and java.io.OutputStream, respectively. Both InputStream and OutputStream support communication through bytes and expose the methods to read or write the information in the form of bytes or byte array. They have many subclasses meant for writing to different destinations and reading from different sources (for example, string buffers and files). But, if we want to send character data (16-bit), then one has to go for the java.io.Reader and java.io.Writer classes. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access