@Override
 public void remove() throws IOException {
   super.remove();
   if (Files.exists(this.tempFile)) {
     Files.delete(this.tempFile);
   }
   diskCacheManager.remove(this);
   latch.countDown();
 }
 @Override
 public void close() throws IOException {
   super.close();
   LOGGER.info(
       "Renaming temp file "
           + tempFile.getFileName().toString()
           + " to "
           + file.getFileName().toString());
   Files.move(tempFile, file);
   diskCacheManager.doneGenerating(this);
   latch.countDown();
 }
 public void writeToOutputStream(OutputStream outputStream, ProgressReporter progressReporter)
     throws SerializerException, IOException {
   try {
     MultiplexingOutputStream multiplexer =
         new MultiplexingOutputStream(outputStream, diskCacheOutputStream);
     serializer.writeToOutputStream(multiplexer);
     try {
       multiplexer.close();
     } catch (EOFException e) {
       // let this one slide
     }
     doneListener.done();
   } catch (Exception e) {
     e.printStackTrace();
     diskCacheOutputStream.remove();
   }
 }