Android InputStream Unzip readEntryAsWhatEverInternal( final ZipEntry entry, final InputStream unzippedInputStream)

Here you can find the source of readEntryAsWhatEverInternal( final ZipEntry entry, final InputStream unzippedInputStream)

Description

read Entry As What Ever Internal

License

Open Source License

Declaration

private static InputStream readEntryAsWhatEverInternal(
            final ZipEntry entry, final InputStream unzippedInputStream)
            throws IOException 

Method Source Code

//package com.java2s;
/*/*from w  ww  . j  av  a  2 s. co  m*/
 * ZipUtils.java: First version written on 16. Feb. 2011.
 * 
 * This file is subject to the terms and conditions defined in
 * file 'licence.txt', which is part of this source code package.
 */

import java.io.IOException;
import java.io.InputStream;

import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

public class Main {
    private static InputStream readEntryAsWhatEverInternal(
            final ZipEntry entry, final InputStream unzippedInputStream)
            throws IOException {
        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;
            }
        }

        if (null == is) {
            throw new IOException("Cannot find the given entry " + entry
                    + " in ZIP file provided");
        }

        return is;
    }
}

Related

  1. decompress(InputStream is, OutputStream os)
  2. decompress(InputStream is, OutputStream os)
  3. decompress(InputStream is, OutputStream os)
  4. uncompress(InputStream inputStream)
  5. unpackZip(Context context, String s, InputStream is)
  6. getZipFileList(InputStream is)
  7. extZipFile(InputStream is, String extPlace)
  8. decompressFile(File destFile, ZipInputStream zis)