Here you can find the source of sanitize(String fileName)
public static final String sanitize(String fileName)
//package com.java2s; public class Main { public static final String sanitize(String fileName) { StringBuffer buffer = new StringBuffer(); for (char c : fileName.toCharArray()) { if (Character.isJavaIdentifierPart(c)) { buffer.append(c);//w ww. j a v a2 s . com } } if (buffer.length() == 0) { buffer.append(System.currentTimeMillis()); } return buffer.toString(); } }