private static void saveOnDisk(BufferExposingByteArrayOutputStream bytes, final File file) throws IOException {
    try (FileOutputStream fos = writeOrCreate(file)) {
      fos.write(bytes.getInternalBuffer(), 0, bytes.size());
    }
  }
private static void saveOnDisk(BufferExposingByteArrayOutputStream bytes, final File file)