Here you can find the source of encodeUri(String url)
public final static String encodeUri(String url) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; public class Main { public final static String encodeUri(String url) throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); DataOutputStream dout = new DataOutputStream(bout); dout.writeUTF(url);//from w w w . java 2s. co m byte[] byteUrl = bout.toByteArray(); StringBuffer buf = new StringBuffer(); for (int i = 0; i < byteUrl.length; i++) { buf.append(byteUrl[i] + "|"); } dout.close(); bout.close(); return buf.toString(); } }