Switch to full style
General Java code examples
Post a reply

Parse URL in java get Protocol,File,Reference,Host and Port

Wed Feb 06, 2013 10:28 pm

Parse URL in java get Protocol,File,Reference,Host
java code
import java.net.*;
import java.io.*;

public class ParseURL {
public static void main(String[] args) throws Exception {
URL aURL = new URL("http://www.codemiles.com");
System.out.println("protocol used = " + aURL.getProtocol());
System.out.println("host = " + aURL.getHost());
System.out.println("filename = " + aURL.getFile());
System.out.println("port = " + aURL.getPort());
System.out.println("ref = " + aURL.getRef());
}
}




Post a reply
  Related Posts  to : Parse URL in java get Protocol,File,Reference,Host and Port
 parse XML file using SAX     -  
 Parse XML using DOM file and run XPath query     -  
 Web scraping and Parse using java... plz help i really need.     -  
 HOW I Access the Parallel Port in Java?     -  
 How to connect to serial port using java     -  
 Java Programing to communicating port parallel     -  
 Java code for DTN Protocol NECTAR evaluation-one simulator     -  
 Java Code for DTN routing protocol NECTAR for evalutaion     -  
 object reference be cast to an interface reference     -  
 many bytes gets allocated for a reference in java     -  

Topic Tags

Java Strings