Java URL Create toURL(String protocol, String host, int port, String path)

Here you can find the source of toURL(String protocol, String host, int port, String path)

Description

to URL

License

Apache License

Declaration

public static String toURL(String protocol, String host, int port, String path) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String toURL(String protocol, String host, int port, String path) {
        StringBuilder sb = new StringBuilder();
        sb.append(protocol).append("://");
        sb.append(host).append(':').append(port);
        if (path.charAt(0) != '/')
            sb.append('/');
        sb.append(path);// w  w w.  java 2s  . c o m
        return sb.toString();
    }
}

Related

  1. createURL(String url)
  2. createURL(String url, String baseURI)
  3. createURL(String urlString)
  4. toUrl(String filename)
  5. toURL(String port, String address, String table)
  6. toUrl(String s)
  7. toUrl(String url)
  8. toUrlDate(String date)
  9. toUrlPagePath(String pagePath)