1 / 8

URL in Java

URL in Java. C343 Lab (Week 13). A Java program can communicate with URLs (Uniform Resource Locator). These can also be used to create a URL object to represent a URL address. Using URL in Java.

napua
Download Presentation

URL in Java

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. URL in Java C343 Lab (Week 13)

  2. A Java program can communicate with URLs (Uniform Resource Locator). These can also be used to create a URL object to represent a URL address.

  3. Using URL in Java The java.net.URL class represents a URL and has complete set of methods to manipulate URL in Java. The URL class has several constructors for creating URLs, including the following:

  4. The URL class contains many methods for accessing the various parts of the URL being represented. Some of the methods in the URL class include the following:

  5. URLConnections Class Methods • The openConnection() method returns a java.net.URLConnection, an abstract class whose subclasses represent the various types of URL connections. • For example: If you connect to a URL whose protocol is HTTP, the openConnection() method returns an HttpURLConnection object. • If you connect to a URL that represents a JAR file, the openConnection() method returns a JarURLConnectionobject. • etc... • The URLConnection class has many methods for setting or determining information about the connection

  6. URLConnections Class Methods:

  7. Examples in URLDemo.java & URLConnDemo.java

  8. Resources • http://www.tutorialspoint.com/java/java_url_processing.htm

More Related