IOUtils { public static File createTemporaryBufferWithName(String filename) throws TaskIOException { try { File tmpDir = createTemporaryFolder(); File buffer = new File(tmpDir, filename); boolean created = buffer.createNewFile(); if (!created) throw new IOException("Could not create new file: " + buffer.getAbsolutePath()); buffer.deleteOnExit(); return buffer; } catch (IllegalStateException | IOException e) { throw new TaskIOException("Unable to create temporary buffer", e); } } 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);  }
@Test public void testCreateBufferWithName() throws TaskIOException { File tmp = IOUtils.createTemporaryBufferWithName("chuck.norris"); tmp.deleteOnExit(); assertTrue(tmp.exists()); assertTrue(tmp.isFile()); assertEquals("chuck.norris", tmp.getName()); }