public static byte[] compress(File[] logFiles, Charset fromEncoding, Charset toEncoding) {
		FileInputStream fis = null;
		InputStreamReader isr = null;
		ByteArrayOutputStream out = null;
		ZipOutputStream zos = null;
		OutputStreamWriter osw = null;
		if (toEncoding == null) {
			toEncoding = Charset.defaultCharset();
		}
		if (fromEncoding == null) {
			fromEncoding = Charset.defaultCharset();
		}
		try {
			out = new ByteArrayOutputStream();
			zos = new ZipOutputStream(out);
			osw = new OutputStreamWriter(zos, toEncoding);
			for (File each : logFiles) {
				try {
					fis = new FileInputStream(each);
					isr = new InputStreamReader(fis, fromEncoding);
					ZipEntry zipEntry = new ZipEntry(each.getName());
					zipEntry.setTime(each.lastModified());
					zos.putNextEntry(zipEntry);
					char[] buffer = new char[COMPRESS_BUFFER_SIZE];
					int count;
					while ((count = isr.read(buffer, 0, COMPRESS_BUFFER_SIZE)) != -1) {
						osw.write(buffer, 0, count);
					}
					osw.flush();
					zos.flush();
					zos.closeEntry();
				} catch (IOException e) {
					LOGGER.error("Error occurs while compressing {} : {}", each.getAbsolutePath(), e.getMessage());
					LOGGER.debug("Details ", e);
				} finally {
					IOUtils.closeQuietly(isr);
					IOUtils.closeQuietly(fis);
				}
			}
			zos.finish();
			zos.flush();
			return out.toByteArray();
		} catch (IOException e) {
			LOGGER.error("Error occurs while compressing log : {} ", e.getMessage());
			LOGGER.debug("Details : ", e);
			return null;
		} finally {
			IOUtils.closeQuietly(zos);
			IOUtils.closeQuietly(out);
			IOUtils.closeQuietly(osw);
		}
	}
Compress multiple Files with the given encoding.

@param logFiles     files to be compressed
@param fromEncoding log file encoding
@param toEncoding   compressed log file encoding
@return compressed file byte array
ngrinder-core/src/main/java/net/grinder/util/LogCompressUtils.java