@Test public void shortenFilenameCharLength() { String shorter = IOUtils.shortenFilenameCharLength(largeFilename, 255); assertThat(shorter, endsWith("aวaวa.pdf")); assertThat(shorter, startsWith("aวaว")); assertThat(shorter.length(), is(255)); }
static String shortenFilenameCharLength(String input, int maxCharLength) { if (input.length() > maxCharLength) { String baseName = getBaseName(input); String ext = getExtension(input); baseName = baseName.substring(0, maxCharLength - 1 - ext.length()); return String.format("%s.%s", baseName, ext); } return input; }
IOUtils { static String shortenFilenameCharLength(String input, int maxCharLength) { if (input.length() > maxCharLength) { String baseName = getBaseName(input); String ext = getExtension(input); baseName = baseName.substring(0, maxCharLength - 1 - ext.length()); return String.format("%s.%s", baseName, ext); } return input; } }
IOUtils { static String shortenFilenameCharLength(String input, int maxCharLength) { if (input.length() > maxCharLength) { String baseName = getBaseName(input); String ext = getExtension(input); baseName = baseName.substring(0, maxCharLength - 1 - ext.length()); return String.format("%s.%s", baseName, ext); } return input; } private  IOUtils(); }
IOUtils { static String shortenFilenameCharLength(String input, int maxCharLength) { if (input.length() > maxCharLength) { String baseName = getBaseName(input); String ext = getExtension(input); baseName = baseName.substring(0, maxCharLength - 1 - ext.length()); return String.format("%s.%s", baseName, ext); } return input; } 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 { static String shortenFilenameCharLength(String input, int maxCharLength) { if (input.length() > maxCharLength) { String baseName = getBaseName(input); String ext = getExtension(input); baseName = baseName.substring(0, maxCharLength - 1 - ext.length()); return String.format("%s.%s", baseName, ext); } return input; } 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);  }