public static void zip(File src, OutputStream os, String charsetName, boolean includeSrc) throws IOException {
		ZipArchiveOutputStream zos = new ZipArchiveOutputStream(os);
		zos.setEncoding(charsetName);
		FileInputStream fis = null;

		int length;
		ZipArchiveEntry ze;
		byte[] buf = new byte[8 * 1024];
		String name;

		Stack<File> stack = new Stack<>();
		File root;
		if (src.isDirectory()) {
			if (includeSrc) {
				stack.push(src);
				root = src.getParentFile();
			} else {
				File[] fs = checkNotNull(src.listFiles());
				for (File f : fs) {
					stack.push(f);
				}

				root = src;
			}
		} else {
			stack.push(src);
			root = src.getParentFile();
		}

		while (!stack.isEmpty()) {
			File f = stack.pop();
			name = toPath(root, f);
			if (f.isDirectory()) {
				File[] fs = checkNotNull(f.listFiles());
				for (File file : fs) {
					if (file.isDirectory()) {
						stack.push(file);
					} else {
						stack.add(0, file);
					}
				}
			} else {
				ze = new ZipArchiveEntry(name);
				zos.putArchiveEntry(ze);
				try {
					fis = new FileInputStream(f);
					while ((length = fis.read(buf, 0, buf.length)) >= 0) {
						zos.write(buf, 0, length);
					}
				} finally {
					IOUtils.closeQuietly(fis);
				}
				zos.closeArchiveEntry();
			}
		}
		zos.close();
	}
Zip the given src into the given output stream.

@param src         src to be zipped
@param os          output stream
@param charsetName character set to be used
@param includeSrc  true if src will be included.
@throws IOException IOException
ngrinder-core/src/main/java/org/ngrinder/common/util/CompressionUtils.java