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

internal.io.FunctionalFileFormatter Maven / Gradle / Ivy

package internal.io;

import lombok.NonNull;
import nbbrd.io.FileFormatter;
import nbbrd.io.function.IOBiConsumer;

import java.io.IOException;
import java.io.OutputStream;

import static nbbrd.io.Resource.uncloseableOutputStream;

@lombok.RequiredArgsConstructor
public final class FunctionalFileFormatter implements FileFormatter {

    private final @NonNull IOBiConsumer function;

    @Override
    public void formatStream(@NonNull T value, @NonNull OutputStream resource) throws IOException {
        function.acceptWithIO(value, uncloseableOutputStream(resource));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy