List of utility methods to do InputStream Unzip
void | unZip(InputStream in, String destDir) un Zip final int BUFFER = 1024; byte data[] = new byte[BUFFER]; ZipInputStream zis = null; try { zis = new ZipInputStream(in); ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { if (entry.isDirectory()) { ... |
boolean | unZip(InputStream is, String filename, String folderPath) un Zip File file = null; FileOutputStream fos = null; try { file = new File(filename); if (!file.exists()) { file.createNewFile(); fos = new FileOutputStream(file); ... |
boolean | unpackZip(InputStream zipStream, String unpackPath) Unzip the specified file from a file Be sure to set : InputStream is; ZipInputStream zis; try { String filename; zis = new ZipInputStream(new BufferedInputStream(zipStream)); ZipEntry ze; byte[] buffer = new byte[1024]; int count; ... |
boolean | unzip(InputStream fileIn, File dirOut) This is not tested on hierarchical zip files, currently only used on flat archives try { ZipInputStream zin = new ZipInputStream(fileIn); ZipEntry ze = null; while ((ze = zin.getNextEntry()) != null) { Log.v("Decompress", "Unzipping " + ze.getName()); if (ze.isDirectory()) { throw new UnsupportedOperationException( "currently only flat archives are supported"); ... |
void | decompress(InputStream is, OutputStream os) decompress GZIPInputStream gis = null; try { gis = new GZIPInputStream(is); int count; byte data[] = new byte[BUFFER]; while ((count = gis.read(data, 0, BUFFER)) != -1) { os.write(data, 0, count); } catch (IOException e) { System.out.println(e.getMessage()); } finally { if (gis != null) { try { gis.close(); } catch (IOException e) { |
void | decompress(InputStream is, OutputStream os) decompress GZIPInputStream gis = null; try { gis = new GZIPInputStream(is); int count; byte data[] = new byte[BUFFER]; while ((count = gis.read(data, 0, BUFFER)) != -1) { os.write(data, 0, count); } catch (IOException e) { System.out.println(e.getMessage()); } finally { if (gis != null) { try { gis.close(); } catch (IOException e) { |
void | decompress(InputStream is, OutputStream os) decompress GZIPInputStream gin = new GZIPInputStream(is); int count; byte data[] = new byte[BUFFERSIZE]; while ((count = gin.read(data, 0, BUFFERSIZE)) != -1) { os.write(data, 0, count); gin.close(); |
String | uncompress(InputStream inputStream) uncompress if (inputStream == null) { return null; ByteArrayOutputStream out = new ByteArrayOutputStream(); GZIPInputStream gunzip = new GZIPInputStream(inputStream); byte[] buffer = new byte[256]; int n; while ((n = gunzip.read(buffer)) >= 0) { ... |
boolean | unpackZip(Context context, String s, InputStream is) Unpack the given InputStream, representing ZIP file, to app cache dir ZipInputStream zis; try { String filename; File cache = context.getCacheDir(); File dir = new File(cache.getAbsolutePath() + "/" + s); dir.mkdir(); zis = new ZipInputStream(new BufferedInputStream(is)); ZipEntry ze; ... |
InputStream | readEntryAsWhatEverInternal( final ZipEntry entry, final InputStream unzippedInputStream) read Entry As What Ever Internal InputStream is = null; ZipInputStream zipIs = null; zipIs = new ZipInputStream(unzippedInputStream); ZipEntry ze; while ((ze = zipIs.getNextEntry()) != null) { if (ze.getName().equals(entry.getName())) { is = zipIs; break; ... |