@Test public void testSwapFileOutputStreamFile_02() throws IOException { String tmpDir = System.getProperty("java.io.tmpdir"); File file = new File(tmpDir + "/SwapFileOutputStreamTest.swp"); if (file.exists()) { file.delete(); } SwapFileOutputStream sfos1 = new SwapFileOutputStream(file); try { SwapFileOutputStream sfos2 = new SwapFileOutputStream(file); sfos2.close(); fail("Expected IOException"); } catch (IOException e) { assertTrue("01", e.getMessage().startsWith("Cannot reuse existing swap file")); } sfos1.close(); }
@Override public void close() throws IOException { if (!closed) { out.close(); closed = true; } }
SwapFileOutputStream extends SwapOutputStream { @Override public void close() throws IOException { if (!closed) { out.close(); closed = true; } } }
SwapFileOutputStream extends SwapOutputStream { @Override public void close() throws IOException { if (!closed) { out.close(); closed = true; } } SwapFileOutputStream(File swapFile);  SwapFileOutputStream(File swapFile, int treshold); }
SwapFileOutputStream extends SwapOutputStream { @Override public void close() throws IOException { if (!closed) { out.close(); closed = true; } } SwapFileOutputStream(File swapFile);  SwapFileOutputStream(File swapFile, int treshold); static SwapFileOutputStream newInstance(); static SwapFileOutputStream newInstance(int treshold); void collect(OutputStream bucket); @Override void close(); void cleanupAndClose(); }
SwapFileOutputStream extends SwapOutputStream { @Override public void close() throws IOException { if (!closed) { out.close(); closed = true; } } SwapFileOutputStream(File swapFile);  SwapFileOutputStream(File swapFile, int treshold); static SwapFileOutputStream newInstance(); static SwapFileOutputStream newInstance(int treshold); void collect(OutputStream bucket); @Override void close(); void cleanupAndClose();  }