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. ...

Get Distributed Computing in Java 9 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.