List of utility methods to do Unzip File
InputStream | uncompress(final InputStream inputStream) Uncompress a given byte array input. return new InflaterInputStream(inputStream); |
void | uncompress(final String zipFileName, final String directory) Uncompress a given zip file named zipFileName over directory named directory. final ZipInputStream zipIs = new ZipInputStream(new BufferedInputStream(new FileInputStream(zipFileName))); ZipEntry entry; int count; final byte data[] = new byte[BUFFER_SIZE]; while ((entry = zipIs.getNextEntry()) != null) { final File file = new File(directory, entry.getName()); if (meetRequirements(file)) { final BufferedOutputStream dest = new BufferedOutputStream(new FileOutputStream(file), BUFFER_SIZE); ... |
ArrayList | uncompress(String chemin, String tempPrefix) uncompress ArrayList<File> result = new ArrayList<File>(); BufferedOutputStream dest = null; FileInputStream fis = new FileInputStream(chemin); BufferedInputStream buffi = new BufferedInputStream(fis); ZipInputStream zis = new ZipInputStream(buffi); ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { File temp = File.createTempFile(tempPrefix, entry.getName()); ... |
String | uncompress(String compressedValue) Uncompress a string value that was compressed using GZIP. if (compressedValue == null) return null; ByteArrayInputStream in = new ByteArrayInputStream(compressedValue.getBytes("ISO-8859-1")); GZIPInputStream gzip = null; Reader reader = null; try { String value = ""; gzip = new GZIPInputStream(in); ... |
void | uncompress(String inputCompressedFile, File outputFile) uncompress GZIPInputStream gzipInputStream = new GZIPInputStream(new FileInputStream(inputCompressedFile)); FileOutputStream fileOutputStream = new FileOutputStream(outputFile); byte[] buffer = new byte[1024]; final int offset = 0; int length; while ((length = gzipInputStream.read(buffer)) > 0) { fileOutputStream.write(buffer, offset, length); gzipInputStream.close(); fileOutputStream.close(); |
void | uncompress(String inputFile, String toDir) uncompress try { FileInputStream tin = new FileInputStream(inputFile); CheckedInputStream cin = new CheckedInputStream(tin, new CRC32()); BufferedInputStream bufferIn = new BufferedInputStream(cin, BUFFER); ZipInputStream in = new ZipInputStream(bufferIn); ZipEntry z = in.getNextEntry(); while (z != null) { String name = z.getName(); ... |
String | uncompress(String str) uncompress try { if (str == null || str.length() == 0) { return str; ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayInputStream in = new ByteArrayInputStream(str.getBytes("ISO-8859-1")); GZIPInputStream gunzip = new GZIPInputStream(in); byte[] buffer = new byte[256]; ... |
byte[] | uncompress(ZipInputStream zipIn) uncompress if (zipIn.getNextEntry() == null) { return null; final int tmpBufSize = 1024; final byte[] tmpBuf = new byte[tmpBufSize]; byte[] output = null; try (final ByteArrayOutputStream st = new ByteArrayOutputStream();) { int count = 0; ... |
void | uncompressDirectory(File zipSource, File target) uncompress Directory ZipInputStream zis = new ZipInputStream(new FileInputStream(zipSource)); try { byte[] readBuffer = new byte[BUFFER_SIZE]; for (ZipEntry entry = zis.getNextEntry(); entry != null; entry = zis.getNextEntry()) { String relativeName = entry.getName(); if (DEBUG) System.out.println("- entry : " + relativeName); int start = 0; ... |
void | uncompressEveryFileFromDirectory(File srcPath, File dstPath) Uncompress data to the destination directory. if (srcPath.isDirectory()) { if (!dstPath.exists()) { dstPath.mkdirs(); String files[] = srcPath.list(); for (int i = 0; i < files.length; i++) { uncompressEveryFileFromDirectory(new File(srcPath, files[i]), new File(dstPath, files[i])); } else { ZipInputStream in = null; OutputStream out = null; try { in = new ZipInputStream(new FileInputStream(srcPath)); in.getNextEntry(); out = new FileOutputStream(dstPath); transfer(in, out); } finally { if (in != null) { in.close(); if (out != null) { out.close(); |