Java InputStream Create getInputStream(File jarFile, String fileName)

Here you can find the source of getInputStream(File jarFile, String fileName)

Description

get Input Stream

License

Open Source License

Declaration

public static InputStream getInputStream(File jarFile, String fileName)
            throws ZipException, IOException 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010 Angelo Zerr and others.
 * 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:/*from w  w w  .  j a  v a  2  s .  c  om*/
 *     Angelo Zerr <angelo.zerr@gmail.com> - Initial API and implementation 
 *******************************************************************************/

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

import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;

public class Main {
    public static InputStream getInputStream(File jarFile, String fileName)
            throws ZipException, IOException {
        ZipFile zipFile = new ZipFile(jarFile);
        ZipEntry zipEntry = zipFile.getEntry(fileName);
        return zipFile.getInputStream(zipEntry);
    }
}

Related

  1. asInputStream(byte[] bytes)
  2. asInputStream(File file)
  3. asInputStream(Object content)
  4. asInputStream(String str)
  5. getInputStream(File f)
  6. getInputStream(File tarFile)
  7. getInputStream(File tarFile)
  8. getInputStream(File TheFile)
  9. getInputStream(FileInputStream fileInput)