/** * Creates a new {@link ZipInputStream} based on the given {@link InputStream}. It will be buffered and close-shielded. * Closing the result stream flushes the buffers and frees up resources of the {@link ZipInputStream}. However the source stream itself remains open. */ private static ZipInputStream newCloseShieldZipInputStream(final InputStream is, Charset charset) { InputStream in = new BufferedInputStream(new CloseShieldInputStream(is)); if (charset == null) { return new ZipInputStream(in); } return ZipFileUtil.createZipInputStream(in, charset); }
/** * Creates a new {@link ZipInputStream} based on the given {@link InputStream}. It will be buffered and close-shielded. * Closing the result stream flushes the buffers and frees up resources of the {@link ZipInputStream}. However the source stream itself remains open. */ private static ZipInputStream newCloseShieldZipInputStream(final InputStream is, Charset charset) { InputStream in = new BufferedInputStream(new CloseShieldInputStream(is)); if (charset == null) { return new ZipInputStream(in); } return ZipFileUtil.createZipInputStream(in, charset); }