Java ZipEntry Read getZipEntry(ZipFile zip, final String name)

Here you can find the source of getZipEntry(ZipFile zip, final String name)

Description

get Zip Entry

License

Open Source License

Declaration

public static ZipEntry getZipEntry(ZipFile zip, final String name)

            throws IOException

    

Method Source Code

//package com.java2s;
/******************************************************************************
 * Copyright (c) 2015 Oracle/*from w  w w . j a  v a 2 s.  com*/
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Konstantin Komissarchik - initial implementation and ongoing maintenance
 ******************************************************************************/

import java.io.IOException;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

public class Main {
    public static ZipEntry getZipEntry(ZipFile zip, final String name)

            throws IOException

    {
        final String lcasename = name.toLowerCase();

        for (Enumeration<?> itr = zip.entries(); itr.hasMoreElements();) {
            final ZipEntry zipentry = (ZipEntry) itr.nextElement();

            if (zipentry.getName().toLowerCase().equals(lcasename)) {
                return zipentry;
            }
        }

        return null;
    }
}

Related

  1. getZipEntry(final ZipFile zipFile, final CharSequence zippedName)
  2. getZipEntry(String name, ZipFile zipFile)
  3. getZipEntry(String zipEntryName)
  4. getZipEntry(String zipFileLoc)
  5. getZipEntry(ZipFile jarFile, String path)
  6. getZipEntry(ZipFile zip, String name)
  7. getZipEntryAsString(File archive, String name)
  8. getZipEntryAsString(InputStream is)
  9. getZipEntryByteContent(ZipEntry ze, ZipFile zip)