Read a file on another machine


In this Magercise, you will open and display a file using a URL (you can use gopher, ftp, file, http, etc...) rather than a local filename.

Details of using URLs to read remote files are covered in the course notes.

Work Location

Perform all work for this magercise in VisualAge project MageLang Magercises, package magercises.Read a File on Another Machine.

If this project does not appear in your Workspace add it from the repository (if it exists there) or create a new project using this name.

Tasks

Perform the following tasks:

  1. Add a text area and title (with the URL location) to the applet using BorderLayout. Open in input stream to the URL specified in the URL applet parameter list else open URLTest.java in the document directory; that is, create:
    new URL(getDocumentBase(), "URLTest.java");
    
    Use the provided method displayFile to display the contents.

The task numbers above are linked to the step-by-step help page. Also available is a complete solution to the problem, and expected behavior, to demonstrate it.

Copyright © 1996-1997 MageLang Institute. All Rights Reserved.