go to previous page   go to home page   go to next page

Answer:

Suspicions verified!


Completing the Class

Now add statements to complete the class. The constructor's argument is a reference to a BufferedReader(). Connecting it to the input stream is the responsibility of main().

class URLscan
{
    in ;  

  URLscan(  br )
  {
    in = ;
  }

  public String getURL()  throws IOException
  {
    final char space = ' ';
    String buffer = null;   // buffer for the URL 
    int  state = 0;         // the current state
    int  readInt;           // value returned by read()
    char current;           // the current character

    while ( (readInt = in.read() ) != -1 )
    {

      . . . . . . .  
    }  

    return null;
  }

}

QUESTION 10:

Click the buttons to finish the class.