Advertisement
TShiva

Zipping

Sep 24th, 2019
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.58 KB | None | 0 0
  1.     private static void cacheZippingFromExistFile() throws IOException {
  2.         final String zipCacheFileName = CACHE_FILE_NAME + ".zip";
  3.         try (ZipOutputStream zout = new ZipOutputStream(new FileOutputStream(zipCacheFileName));
  4.              FileInputStream fis = new FileInputStream(CACHE_FILE_NAME)) {
  5.             final ZipEntry entry = new ZipEntry("H8Cache");
  6.             zout.putNextEntry(entry);
  7.             final byte[] buffer = new byte[fis.available()];
  8.             fis.read(buffer);
  9.             zout.write(buffer);
  10.             zout.closeEntry();
  11.         }
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement