Here you can find the source of toString(URI uri)
Parameter | Description |
---|---|
uri | the URI to return the string representation for. |
public static String toString(URI uri)
//package com.java2s; import java.net.URI; public class Main { /**/*from ww w .j a va2s . c om*/ * Creates a String from a URI, the URI can be relative or absolute, the URI is decoded. * * TODO Why can't I just return uri.toString()??? * * @param uri the URI to return the string representation for. * @return a string representation of the URI. */ public static String toString(URI uri) { StringBuffer buffer = new StringBuffer(); if (uri.getScheme() != null) { buffer.append(uri.getScheme()); buffer.append(":"); } buffer.append(uri.getSchemeSpecificPart()); if (uri.getFragment() != null) { buffer.append("#"); buffer.append(uri.getFragment()); } return buffer.toString(); } }