Java wget Class for Content Retrieval from Web Server

Java Content Retrieval from Web Server or URL

The following example program written in Java for Retrieving content from Webserver or from URL by wget class. In Java, the wget is the class used to retrieve the web content through HTTP, HTTPS and FTP protocols. This wget function is well supported by the TCP/IP protocols to access through web browsers. The wget function is more useful to convert the online content by downloading it to local machine and make it available to read as offline content

Java Example for wget Function


import java.io.*;
import java.net.*;

public class wget {
public static void main(String[] args) throws Exception {
String s;
BufferedReader r = new BufferedReader(new InputStreamReader(new URL(args[0]).openStream()));
while ((s = r.readLine()) != null) {
System.out.println(s);
}
}
}


Related Topic RSS Feed Reader Parser in JSP
The Multipurpose Internet Mail Extensions MIME Types
Servlet Interview Questions & Answers
JSP Interview Questions & Answers
Sending Data Post Method in android
Java  Web Server  HTTP  

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback