Get URL Content : URL : Network Protocol : Java examples (example source code) Organized by topic

Java
C++
PHP
Java Home »  Network Protocol   » [  URL  ]  Screenshots 
 



Get URL Content


import java.net.MalformedURLException;
import java.net.URL;

public class Getobject {

  public static void main(String args[]) {

    String thisLine;
    URL u;

    //Open the URL for reading
    try {
      u = new URL("http://www.java2s.com");
      try {
        Object o = u.getContent();
        System.out.println("I got a " + o.getClass().getName());
      // end try
      catch (Exception e) {
        System.err.println(e);
      }
    // end try
    catch (MalformedURLException e) {
      System.err.println(args[0" is not a parseable URL");
      System.err.println(e);
    }

  // end main

// end getobject

           
       
Related examples in the same category
1.  URL Constructor Test
2.  URL Encode Test
3.  Get URL Parts
4.  Read from a URL
5.  URL Equality
6.  URL Request
7.  URL Get
8.  URL Reader
9.  URL Connection Reader URL Connection Reader
10.  URLConnection
11.  Parse URL Parse URL








Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.