Here you can find the source of cleanPathSegment(final String toClean)
public static String cleanPathSegment(final String toClean)
//package com.java2s; //License from project: Apache License public class Main { /**//from ww w . j av a2s. com * Removes characters that aren't acceptable in a file path (mostly for windows). */ public static String cleanPathSegment(final String toClean) { final String cleaned = toClean.replaceAll("[.\\\\/:*?\"<>|\\[\\]\\(\\)]", ""); if (cleaned.length() == 0) throw new IllegalStateException( "Path segment " + toClean + " has not valid characters and is thus empty"); return cleaned; } }