FileReading across Internet Example
 

This a modifies example is from "Teach yourself Java..." by Laura Lemay et.al.   It is an application that accepts a URL as a parameter to the program and then simply reads in the data stored in the URL and prints it out in a text area.
 

 Download_application

About this example:

1)  This application is a subclass of the Frame class (and hence has a GUI).

2)   It contains only one component a text area where the information in the file located at the URL will be printed in it.

3)   This program is threaded so that the work of loading the HTML document occurs in its own thread....leaving the rest of the Java program free to handle other tasks like updaing the display area or recieving user input (if there was any).

4) You must import java.net  and java.io packages!   Also, remember that you must around any
stream/file reading catch I/OException as we did before with file I/O.

5) SEE BOOK FOR STEP BY STEP EXPLANATION OF CODE.....OR OUR IN-CLASS DISCUSSION.
 

© Lynne Grewe