Question: Modify this chapters WebPageReader program to read a web page through a buffer. Instead of importing InputStream, import BufferedReader and InputStreamReader. Instead of: use: And

Modify this chapter’s WebPageReader program to read a web page through a buffer.

Instead of importing InputStream, import BufferedReader and InputStreamReader.

Instead of:

instream = webIn = connection.getInputStream(); new Scanner (instream);

use:

reader new Buffered Reader ( new InputStreamReader (connection.getInputStream())); =

And instead of:

while (i < maxI && webIn.nextLine()) { } System.out.println(webIn.nextLine()); i++;

use:

for (int i=0; i < maxI; i++) { } System.out.println(reader.readLine()); First sample session: Enter a full

instream = webIn = connection.getInputStream(); new Scanner (instream);

Step by Step Solution

3.43 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To modify the WebPageReader program as described you need to replace the use of Scanner to read from an InputStream with a BufferedReader that wraps a... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction To Programming With Java A Problem Solving Approach Questions!