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

uk.co.mruoc.file.FileSystemInputStreamLoader Maven / Gradle / Ivy

Go to download

Code library to easily load files and file from the classpath or file system file

The newest version!
package uk.co.mruoc.file;

import java.io.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@RequiredArgsConstructor
public class FileSystemInputStreamLoader implements InputStreamLoader {

    private final PathValidator pathValidator;

    public FileSystemInputStreamLoader() {
        this(new PathValidator());
    }

    @Override
    public InputStream load(String path) {
        pathValidator.validate(path);
        try {
            log.debug("loading input stream from file system using path {}", path);
            return new FileInputStream(path);
        } catch (FileNotFoundException e) {
            throw new FileLoadException(path, e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy