All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.buschmais.jqassistant.plugin.common.api.scanner.filesystem.ZipFileResource Maven / Gradle / Ivy

The newest version!
package com.buschmais.jqassistant.plugin.common.api.scanner.filesystem;

import org.apache.commons.compress.archivers.zip.ZipFile;

import java.io.Closeable;
import java.io.File;
import java.io.IOException;

/**
 * Represents a ZIP file resource.
 */
public class ZipFileResource implements Closeable {
    private final ZipFile zipFile;
    private final String path;

    public ZipFileResource(File file) throws IOException {
        path = file.getPath();
        this.zipFile = new ZipFile(file);
    }

    @Override
    public String toString() {
        return getPath();
    }

    public String getPath() {
        return path;
    }

    @Override
    public void close() throws IOException {
        zipFile.close();
    }

    /**
     * Returns the underlying {@link ZipFile ZIP file}.
     *
     * @return Returns the underlaying ZIP file, never {@code null}.
     */
    public ZipFile getZipFile() {
        return zipFile;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy