Create a Compressed Zip File in Java


This is a simple Java code to Create a zip File ......

Write a program to compress files in zip using Java

import; import; import; import; public class Main { public static void main(String[] args) throws Exception { FileInputStream in = new FileInputStream("list.txt"); ZipOutputStream out = new ZipOutputStream(new FileOutputStream("")); out.putNextEntry(new ZipEntry("list.txt")); byte[] buffer = new byte[1024]; int bytesRead; while ((bytesRead = > 0) { out.write(buffer, 0, bytesRead); } out.closeEntry(); out.close(); in.close(); } }

Solution Worked 0 UpvotesUpvote


Solution Didn't Worked 0 DownvotesDownvote


Get Programming Help

Play 2048 Game Online

Search Tags