Class URLTextReader

java.lang.Object
  |
  +--java.io.Reader
        |
        +--URLTextReader

public class URLTextReader
extends java.io.Reader

Read text from the Internet, given a URL. Reading is performed by a java.io.BufferedReader so as to provide efficient reading of characters, arrays, and lines.


Field Summary
private  java.io.BufferedReader reader
           
 
Fields inherited from class java.io.Reader
lock
 
Constructor Summary
URLTextReader(java.net.URL u)
          Create a buffering URL text reader, given a URL.
 
Method Summary
 void close()
          Close the stream.
 int read(char[] cbuf, int off, int len)
          Read characters into a portion of an array.
 java.lang.String readLine()
          Read a line of text.
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reader

private java.io.BufferedReader reader
Constructor Detail

URLTextReader

public URLTextReader(java.net.URL u)
Create a buffering URL text reader, given a URL.

Parameters:
u - The URL to read.
Method Detail

read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.IOException
Read characters into a portion of an array.

Specified by:
read in class java.io.Reader
Parameters:
cbuf - The array in which to put the read characters.
off - The starting offset into the array.
len - The number of characters to read.
Returns:
The number of characters actually read.
java.io.IOException

readLine

public java.lang.String readLine()
                          throws java.io.IOException
Read a line of text.

Returns:
The line of text that was read.
java.io.IOException

close

public void close()
           throws java.io.IOException
Close the stream.

Specified by:
close in class java.io.Reader
java.io.IOException