Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
diasf committed Apr 2, 2024
1 parent 6c90c60 commit 53b67f9
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@
*/
public class ZipFileBuilder implements Closeable {

private final ZipOutputStream zip_output_stream;
private final ZipOutputStream zipOutputStream;

// -------------------- CONSTRUCTOR --------------------

public ZipFileBuilder(Path outputZipFilename) throws IOException {
zip_output_stream = new ZipOutputStream(Files.newOutputStream(outputZipFilename));
zipOutputStream = new ZipOutputStream(Files.newOutputStream(outputZipFilename));
}

// -------------------- LOGIC --------------------

public void addToZipFile(Path filePath) throws IOException {
try(InputStream inputStream = Files.newInputStream(filePath)) {
zip_output_stream.putNextEntry(new ZipEntry(filePath.getFileName().toString()));
IOUtils.copy(inputStream, zip_output_stream);
zip_output_stream.closeEntry();
zipOutputStream.putNextEntry(new ZipEntry(filePath.getFileName().toString()));
IOUtils.copy(inputStream, zipOutputStream);
zipOutputStream.closeEntry();
}
}

@Override
public void close() throws IOException {
zip_output_stream.close();
zipOutputStream.close();
}
}

0 comments on commit 53b67f9

Please sign in to comment.