URI ToASCIIString() Example

Returns the content of this URI as a US-ASCII string.


URIclass ToASCIIString() method example. This example shows you how to use ToASCIIString() method.This method Returns the content of this URI as a US-ASCII string.

Here is the code:-

/**
 * @Program that Returns the content of this URI as a US-ASCII string.
 * ToASCIIString.java 
 * Author:-RoseIndia Team
 * Date:-24-jun-2008
 */
import java.net.*;

public class ToASCIIString {
 public static void main(String[] argsthrows Exception {
        String scheme = "http";
        String userInfo = "girish";
        String host = "tewari.com";
        int port = 8080;
        String path = "/mail/";
        String query = "open";
        String fragment = "inbox";
        URI uri = new URI(scheme, userInfo, host, port, path, query, fragment);
        System.out.println("Given new URI is: " + uri);
        //Returns the content of this URI as a US-ASCII string.
        System.out.println("Given URI as a US-ASCII string is: " + uri.toASCIIString());
    }
}

Output of the program:-
 Given new URI is: http://girish@tewari.com:8080/mail/?open#inbox
Given URI as a US-ASCII string is: http://girish@tewari.com:8080/mail/?open#inbox

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US