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

org.qbicc.machine.tool.process.OutputStreamConsumerInputSource Maven / Gradle / Ivy

There is a newer version: 0.77.0
Show newest version
package org.qbicc.machine.tool.process;

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

import io.smallrye.common.constraint.Assert;
import io.smallrye.common.function.ExceptionBiConsumer;

final class OutputStreamConsumerInputSource extends InputSource {
    private final ExceptionBiConsumer consumer;
    private final T param;

    OutputStreamConsumerInputSource(final ExceptionBiConsumer consumer, final T param) {
        this.consumer = consumer;
        this.param = param;
    }

    public void transferTo(final OutputDestination destination) throws IOException {
        destination.transferFrom(this);
    }

    ProcessBuilder.Redirect getInputRedirect() {
        return ProcessBuilder.Redirect.PIPE;
    }

    void transferTo(final OutputStream os) throws IOException {
        consumer.accept(param, os);
    }

    InputStream openStream() {
        throw Assert.unsupported();
    }

    @Override
    public String toString() {
        return "";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy