Here you can find the source of encodeFilename(String filename, String encoding)
public static String encodeFilename(String filename, String encoding) throws Exception
//package com.java2s; //License from project: Apache License import java.net.URLEncoder; public class Main { public static String encodeFilename(String filename, String encoding) throws Exception { String splChars = ".*[#$%?@].*"; if (filename.matches(splChars)) return URLEncoder.encode(filename, encoding); return filename; }// www.j a va 2 s . com }