Shortest Java program to do wget


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import java.io.*;
  2. import java.net.*;
  3.  
  4. public class wget {
  5. public static void main(String[] args) throws Exception {
  6. String s;
  7. BufferedReader r = new BufferedReader(new InputStreamReader(new URL(args[0]).openStream()));
  8. while ((s = r.readLine()) != null) {
  9. System.out.println(s);
  10. }
  11. }
  12. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.