Guest User

Untitled

a guest
Nov 21st, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. ByteArrayOutputStream bos = new ByteArrayOutputStream();
  2. ZipOutputStream zos = new ZipOutputStream(bos);
  3. ZipEntry ze = new ZipEntry(“Temp.txt”);
  4. zos.putNextEntry(ze);
  5. FileInputStream fis = new FileInputStream("Test/File1.txt");
  6. byte[] buffer = new byte[1024];
  7. int len;
  8. while ((len = fis.read(buffer)) > 0) {
  9. //System.out.println(new String(buffer));
  10. zos.write(buffer, 0, len);
  11. }
Add Comment
Please, Sign In to add comment