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

org.expath.pkg.repo.XarFileSource Maven / Gradle / Ivy

There is a newer version: 2.1.1
Show newest version
package org.expath.pkg.repo;

import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;

public class XarFileSource implements XarSource {

    private final Path xarFile;

    public XarFileSource(final Path xarFile) {
        this.xarFile = xarFile;
    }

    @Override
    public URI getURI() {
        return xarFile.toUri();
    }

    @Override
    public boolean isValid() {
        return Files.exists(xarFile) && !Files.isDirectory(xarFile);
    }

    @Override
    public InputStream newInputStream() throws IOException {
        return Files.newInputStream(xarFile);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy