Here you can find the source of toUri(String ip, String path)
public static String toUri(String ip, String path)
//package com.java2s; //License from project: Apache License import java.net.URL; public class Main { public static String toUri(String ip, String path) { try {// w w w .ja v a 2s .c o m URL url = new URL(new URL(ip), path); return url.toExternalForm(); } catch (Exception e) { return null; } } }