O'Reilly logo

Just Java™ 2 by Peter van der Linden

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Inputting ASCII Characters and Binary Values

You choose an input stream when you want to bring bytes into your program. As with Readers, you decide where you want to read from, and choose one of the InputStream classes accordingly (see Table 17-7).

Table 17-7. Choose the InputStream class based on the source of the input

image

As before, you connect to socket and URL input streams using a method call, rather than a constructor. The method getInputStream() returns an input stream connected to the network resource, as shown in Table 17-8.

Table 17-8. Choose the getInputStream() method based on the source of the data

Read input from

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required