@Test public void testCreateBufferFileOutNonExisting() throws TaskIOException { FileTaskOutput out = new FileTaskOutput(new File("I dont", "exist")); File tmp = IOUtils.createTemporaryBuffer(out); assertTrue(tmp.exists()); assertTrue(tmp.isFile()); assertEquals(SystemUtils.getJavaIoTmpDir().getAbsolutePath(), tmp.getParent()); }
public static File createTemporaryBuffer(TaskOutput taskOut) throws TaskIOException { TmpBufferLocationFinder bufferLocationFinder = new TmpBufferLocationFinder(); try { taskOut.accept(bufferLocationFinder); File buffer = tmpFile(bufferLocationFinder.bufferLocation).toFile(); buffer.deleteOnExit(); return buffer; } catch (TaskOutputVisitException | IOException e) { try { return createTemporaryBuffer(); } catch (TaskIOException ex) { throw new TaskIOException("Unable to create temporary buffer", ex); } } }
IOUtils { public static File createTemporaryBuffer(TaskOutput taskOut) throws TaskIOException { TmpBufferLocationFinder bufferLocationFinder = new TmpBufferLocationFinder(); try { taskOut.accept(bufferLocationFinder); File buffer = tmpFile(bufferLocationFinder.bufferLocation).toFile(); buffer.deleteOnExit(); return buffer; } catch (TaskOutputVisitException | IOException e) { try { return createTemporaryBuffer(); } catch (TaskIOException ex) { throw new TaskIOException("Unable to create temporary buffer", ex); } } } }
IOUtils { public static File createTemporaryBuffer(TaskOutput taskOut) throws TaskIOException { TmpBufferLocationFinder bufferLocationFinder = new TmpBufferLocationFinder(); try { taskOut.accept(bufferLocationFinder); File buffer = tmpFile(bufferLocationFinder.bufferLocation).toFile(); buffer.deleteOnExit(); return buffer; } catch (TaskOutputVisitException | IOException e) { try { return createTemporaryBuffer(); } catch (TaskIOException ex) { throw new TaskIOException("Unable to create temporary buffer", ex); } } } private  IOUtils(); }
IOUtils { public static File createTemporaryBuffer(TaskOutput taskOut) throws TaskIOException { TmpBufferLocationFinder bufferLocationFinder = new TmpBufferLocationFinder(); try { taskOut.accept(bufferLocationFinder); File buffer = tmpFile(bufferLocationFinder.bufferLocation).toFile(); buffer.deleteOnExit(); return buffer; } catch (TaskOutputVisitException | IOException e) { try { return createTemporaryBuffer(); } catch (TaskIOException ex) { throw new TaskIOException("Unable to create temporary buffer", ex); } } } 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 File createTemporaryBuffer(TaskOutput taskOut) throws TaskIOException { TmpBufferLocationFinder bufferLocationFinder = new TmpBufferLocationFinder(); try { taskOut.accept(bufferLocationFinder); File buffer = tmpFile(bufferLocationFinder.bufferLocation).toFile(); buffer.deleteOnExit(); return buffer; } catch (TaskOutputVisitException | IOException e) { try { return createTemporaryBuffer(); } catch (TaskIOException ex) { throw new TaskIOException("Unable to create temporary buffer", ex); } } } 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);  }