@Override
public OutputStream makeOutputStream(String filename) throws IOException
{
File retFile = createdFiles.get(filename);
if (retFile == null) {
retFile = File.createTempFile("filePeon", filename);
retFile.deleteOnExit();
createdFiles.put(filename, retFile);
return new BufferedOutputStream(new FileOutputStream(retFile));
} else if (allowOverwrite) {
return new BufferedOutputStream(new FileOutputStream(retFile));
} else {
throw new IOException("tmp file conflicts, file[" + filename + "] already exist!");
}
}
retFile.deleteOnExit(); - create a memory leak due to JVM are exited.
retFile.deleteOnExit(); - create a memory leak due to JVM are exited.