Here you can find the source of addZipEntry(String pathName, byte[] contents, ZipOutputStream zos)
Parameter | Description |
---|---|
pathName | the path name |
contents | the contents |
zos | the zos |
Parameter | Description |
---|---|
IOException | Signals that an I/O exception has occurred. |
public static void addZipEntry(String pathName, byte[] contents, ZipOutputStream zos) throws IOException
//package com.java2s; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; public class Main { /**/*w ww . jav a2s. c om*/ * Adds the zip entry. * * @param pathName the path name * @param contents the contents * @param zos the zos * @throws IOException Signals that an I/O exception has occurred. */ public static void addZipEntry(String pathName, byte[] contents, ZipOutputStream zos) throws IOException { ZipEntry entry = new ZipEntry(pathName); entry.setSize(contents.length); zos.putNextEntry(entry); zos.write(contents); zos.closeEntry(); } }