Here you can find the source of cleanFilename(String filename)
public static String cleanFilename(String filename)
//package com.java2s; //License from project: Open Source License public class Main { public static final String VALID_FILENAME_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.@-"; public static String cleanFilename(String filename) { byte[] fnBytes = filename.getBytes(); byte c;//w w w. ja v a2 s . co m for (int i = 0; i < fnBytes.length; i++) { c = fnBytes[i]; if (VALID_FILENAME_CHARS.indexOf(c) == -1) { fnBytes[i] = '_'; } } return new String(fnBytes); } }