Solved

Java Text files

Posted on 2001-06-08
2
159 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
ID: 6169817
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
ID: 6780603
:-)

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

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

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jar file executable 12 58
windows explorer path to command prompt 5 54
Why my table column Id is not passed to java object? 4 44
Notify sent to other threads in Java 9 33
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

860 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