Solved

Java Text files

Posted on 2001-06-08
2
156 Views
Last Modified: 2010-03-31
I'm looking for a script in Java or JSP that allows me to enter a URL and extract all of the HTML Code into a text file on the Server? Does anyone have a script out there I can look at, or know of a place I can get a hold of one?

 Many thanks
0
Comment
Question by:7of9121098
  • 2
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 50 total points
Comment Utility
Try something like this:


URL url = new URL("http://www.abc.com");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
PrintWriter out = new PrintWriter(new FileOutputStream("output.html"));
String line;
while (null!=(line=in.readLine()))
{
  out.println(line);
}
in.close();
out.close();
0
 
LVL 92

Expert Comment

by:objects
Comment Utility
:-)

Mick Barry
Brainbench MVP for Java 1
http://www.brainbench.com

http://www.objects.com.au
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now