
internal.io.FunctionalFileParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-io-base Show documentation
Show all versions of java-io-base Show documentation
Common IO utilities - Base
package internal.io;
import lombok.NonNull;
import nbbrd.io.FileParser;
import nbbrd.io.function.IOFunction;
import java.io.IOException;
import java.io.InputStream;
import java.util.Objects;
import static nbbrd.io.Resource.uncloseableInputStream;
@lombok.RequiredArgsConstructor
public final class FunctionalFileParser implements FileParser {
private final @NonNull IOFunction super InputStream, ? extends T> function;
@Override
public @NonNull T parseStream(@NonNull InputStream resource) throws IOException {
return Objects.requireNonNull(function.applyWithIO(uncloseableInputStream(resource)), "result");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy