Java String Encode encodeFilename(String filename, String encoding)

Here you can find the source of encodeFilename(String filename, String encoding)

Description

encode Filename

License

Apache License

Declaration

public static String encodeFilename(String filename, String encoding) throws Exception 

Method Source Code

//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
}

Related

  1. encodeConvenience(String str)
  2. encodeDataPair(final StringBuilder buffer, final String key, final String value)
  3. encodeDoublePercent(String input)
  4. encodeDownloadFileName(String s)
  5. encodeFilename(final String filename, final String userAgent)
  6. encodeFilenameOmittingWhiteSpaces(String filename, String encoding)
  7. encodeForm(Map form)
  8. encodeIncludingSpecialCharacters(String toEncode)
  9. encodeInternally(String s)