@Test public void testStrictFilename() { assertEquals("1_Invoice0001", IOUtils.toStrictFilename("1_Invoice#0001:*<>/\\")); assertEquals(StringUtils.repeat('a', 255), IOUtils.toStrictFilename(StringUtils.repeat('a', 256))); }
public static String toStrictFilename(String input) { String safe = defaultIfBlank(input, "").replaceAll("[^A-Za-z0-9_ .-]", ""); if (safe.length() > 255) { safe = safe.substring(0, 255); } return safe; }
IOUtils { public static String toStrictFilename(String input) { String safe = defaultIfBlank(input, "").replaceAll("[^A-Za-z0-9_ .-]", ""); if (safe.length() > 255) { safe = safe.substring(0, 255); } return safe; } }
IOUtils { public static String toStrictFilename(String input) { String safe = defaultIfBlank(input, "").replaceAll("[^A-Za-z0-9_ .-]", ""); if (safe.length() > 255) { safe = safe.substring(0, 255); } return safe; } private  IOUtils(); }
IOUtils { public static String toStrictFilename(String input) { String safe = defaultIfBlank(input, "").replaceAll("[^A-Za-z0-9_ .-]", ""); if (safe.length() > 255) { safe = safe.substring(0, 255); } return safe; } private  IOUtils(); static File createTemporaryBuffer(TaskOutput taskOut); static File createTemporaryBuffer(); static File createTemporaryBuffer(String extension); static File createTemporaryBufferWithName(String filename); static File createTemporaryFolder(); static File findNewNameThatDoesNotExist(File output); static String shortenFilename(String name); static String toSafeFilename(String input); static String toStrictFilename(String input); }
IOUtils { public static String toStrictFilename(String input) { String safe = defaultIfBlank(input, "").replaceAll("[^A-Za-z0-9_ .-]", ""); if (safe.length() > 255) { safe = safe.substring(0, 255); } return safe; } private  IOUtils(); static File createTemporaryBuffer(TaskOutput taskOut); static File createTemporaryBuffer(); static File createTemporaryBuffer(String extension); static File createTemporaryBufferWithName(String filename); static File createTemporaryFolder(); static File findNewNameThatDoesNotExist(File output); static String shortenFilename(String name); static String toSafeFilename(String input); static String toStrictFilename(String input);  }