public static byte[] file2ByteArray(File file, boolean zip)
			throws IOException {
		if (file.isFile()) {
			InputStream is = null;
			GZIPOutputStream gzip = null;
			byte[] buffer = new byte[8912];
			ByteArrayOutputStream baos = new ByteArrayOutputStream(8912);
			try {
				if (zip) {
					gzip = new GZIPOutputStream(baos);
				}
				is = new BufferedInputStream(new FileInputStream(file));
				int read = 0;
				while ((read = is.read(buffer)) != -1) {
					if (zip) {
						gzip.write(buffer, 0, read);
					} else {
						baos.write(buffer, 0, read);
					}
				}
			} catch (IOException e) {
				throw e;
			} finally {
				closeQuietly(is);
				closeQuietly(gzip);
			}
			return baos.toByteArray();
		} else {
			return new byte[] {};
		}
	}