Solved

Java Text files

Posted on 2001-06-08
2
166 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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…
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

626 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