public InputStream getInputStream()

in src/main/org/apache/ant/compress/resources/ZipResource.java [111:142]


    public InputStream getInputStream() throws IOException {
        if (isReference()) {
            return ((Resource) getCheckedRef()).getInputStream();
        }
        File f = getZipfile();
        if (f == null) {
            return super.getInputStream();
        }

        final ZipFile z = new ZipFile(f, getEncoding());
        ZipArchiveEntry ze = z.getEntry(getName());
        if (ze == null) {
            z.close();
            throw new BuildException("no entry " + getName() + " in "
                                     + getArchive());
        }
        return new FilterInputStream(z.getInputStream(ze)) {
            @Override
            public void close() throws IOException {
                FileUtils.close(in);
                z.close();
            }
            @Override
            protected void finalize() throws Throwable {
                try {
                    close();
                } finally {
                    super.finalize();
                }
            }
        };
    }