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

uk.co.mruoc.file.line.DefaultFileLineLoader 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.line;

import java.io.BufferedReader;
import java.io.IOException;
import java.util.Collection;
import lombok.RequiredArgsConstructor;
import uk.co.mruoc.file.BufferedReaderLoader;
import uk.co.mruoc.file.FileLoadException;

@RequiredArgsConstructor
public class DefaultFileLineLoader implements FileLineLoader {

    private final BufferedReaderLoader bufferedReaderLoader;

    @Override
    public Collection loadLines(String path) {
        try (BufferedReader reader = bufferedReaderLoader.load(path)) {
            return reader.lines().toList();
        } catch (IOException e) {
            throw new FileLoadException(path, e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy