// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

public class UnZip {
    public static InputStream GetZipStream(String zipfnm, String entnam) throws IOException {
        ZipFile zf = new ZipFile(zipfnm);
        ZipEntry ze = zf.getEntry(entnam);
        if(ze == null) {
            throw new IOException("Zip entry " + entnam + " not found");
        }
        return zf.getInputStream(ze);
    }
    public static void main(String[] args) throws Exception  {
        InputStream is = GetZipStream("/work/z.zip", "crc8.c");
        int c;
        while((c = is.read()) >= 0) System.out.print((char)c);
        System.out.println();
    }
}
