Class OutputDestination

java.lang.Object
org.qbicc.machine.tool.process.OutputDestination

public abstract class OutputDestination extends Object
A destination to send input to.
See Also:
  • Method Details

    • discarding

      public static OutputDestination discarding()
      An output destination that efficiently discards the input.
      Returns:
      the output destination
    • of

      public static <T> OutputDestination of(io.smallrye.common.function.ExceptionBiConsumer<T,InputStream,IOException> consumer, T param)
      An output destination that calls the given consumer with an input stream.
      Type Parameters:
      T - the parameter type
      Parameters:
      consumer - the stream consumer (must not be null)
      param - the parameter to pass to the stream consumer
      Returns:
      the output destination
    • of

      public static OutputDestination of(io.smallrye.common.function.ExceptionConsumer<InputStream,IOException> consumer)
      An output destination that calls the given consumer with an input stream.
      Parameters:
      consumer - the stream consumer (must not be null)
      Returns:
      the output destination
    • of

      public static <T> OutputDestination of(io.smallrye.common.function.ExceptionFunction<T,OutputStream,IOException> supplier, T param)
      An output destination that writes to an output stream provided by the given supplier.
      Type Parameters:
      T - the parameter type
      Parameters:
      supplier - the stream supplier (must not be null)
      param - the parameter to pass to the stream supplier
      Returns:
      the output destination
    • of

      public static OutputDestination of(io.smallrye.common.function.ExceptionSupplier<OutputStream,IOException> supplier)
      An output destination that writes to an output stream provided by the given supplier.
      Parameters:
      supplier - the stream supplier (must not be null)
      Returns:
      the output destination
    • of

      public static <T> OutputDestination of(io.smallrye.common.function.ExceptionBiConsumer<T,Reader,IOException> consumer, T param, Charset charset)
      An output destination that calls the given consumer with a reader.
      Type Parameters:
      T - the parameter type
      Parameters:
      consumer - the stream consumer (must not be null)
      param - the parameter to pass to the stream consumer
      charset - the character set (must not be null)
      Returns:
      the output destination
    • of

      public static OutputDestination of(io.smallrye.common.function.ExceptionConsumer<Reader,IOException> consumer, Charset charset)
      An output destination that calls the given consumer with a reader.
      Parameters:
      consumer - the stream consumer (must not be null)
      charset - the character set (must not be null)
      Returns:
      the output destination
    • of

      public static <T> OutputDestination of(io.smallrye.common.function.ExceptionFunction<T,Appendable,IOException> supplier, T param, Charset charset)
      An output destination that writes to an appendable provided by the given supplier. The appendable will be closed if it implements Closeable.
      Type Parameters:
      T - the parameter type
      Parameters:
      supplier - the supplier (must not be null)
      param - the parameter to pass to the stream supplier
      charset - the character set (must not be null)
      Returns:
      the output destination
    • of

      public static OutputDestination of(io.smallrye.common.function.ExceptionSupplier<Appendable,IOException> supplier, Charset charset)
      An output destination that writes to an appendable provided by the given supplier. The appendable will be closed if it implements Closeable.
      Parameters:
      supplier - the stream supplier (must not be null)
      charset - the character set (must not be null)
      Returns:
      the output destination
    • of

      public static OutputDestination of(Path path)
      An output destination that writes to a file on the filesystem.
      Parameters:
      path - the path to write to (must not be null)
      Returns:
      the output destination
    • of

      public static OutputDestination of(Appendable appendable, Charset charset)
      An output destination that writes to the given Appendable. Note that the destination is not reusable.
      Parameters:
      appendable - the appendable to write to
      charset - the character set (must not be null)
      Returns:
      the output destination
    • of

      public static OutputDestination of(Appendable appendable)
      An output destination that writes to the given Appendable. Note that the destination is not reusable. The UTF-8 character set is assumed.
      Parameters:
      appendable - the appendable to write to
      Returns:
      the output destination
    • of

      public static <T> OutputDestination of(io.smallrye.common.function.ExceptionFunction<T,ProcessBuilder,IOException> supplier, T param, OutputDestination errorDest, OutputDestination outputDest)
      An output destination that pipes into a process. The process builder's redirection settings will be overwritten.
      Type Parameters:
      T - the parameter type
      Parameters:
      supplier - the process builder supplier (must not be null)
      param - the parameter to pass to the process builder supplier
      errorDest - the output destination for the process error stream (must not be null)
      outputDest - the output destination for the process output stream (must not be null)
      Returns:
      the output destination
    • of

      public static <T> OutputDestination of(io.smallrye.common.function.ExceptionFunction<T,ProcessBuilder,IOException> supplier, T param, OutputDestination errorDest, OutputDestination outputDest, io.smallrye.common.function.ExceptionConsumer<Process,IOException> checker)
      An output destination that pipes into a process. The process builder's redirection settings will be overwritten.
      Type Parameters:
      T - the parameter type
      Parameters:
      supplier - the process builder supplier (must not be null)
      param - the parameter to pass to the process builder supplier
      errorDest - the output destination for the process error stream (must not be null)
      outputDest - the output destination for the process output stream (must not be null)
      checker - the process exit code checker to use (must not be null)
      Returns:
      the output destination
    • of

      public static OutputDestination of(io.smallrye.common.function.ExceptionSupplier<ProcessBuilder,IOException> supplier, OutputDestination errorDest, OutputDestination outputDest)
      An output destination that pipes into a process. The process builder's redirection settings will be overwritten.
      Parameters:
      supplier - the process builder supplier (must not be null)
      errorDest - the output destination for the process error stream (must not be null)
      outputDest - the output destination for the process output stream (must not be null)
      Returns:
      the output destination
    • of

      public static OutputDestination of(io.smallrye.common.function.ExceptionSupplier<ProcessBuilder,IOException> supplier, OutputDestination errorDest, OutputDestination outputDest, io.smallrye.common.function.ExceptionConsumer<Process,IOException> checker)
      An output destination that pipes into a process. The process builder's redirection settings will be overwritten.
      Parameters:
      supplier - the process builder supplier (must not be null)
      errorDest - the output destination for the process error stream (must not be null)
      outputDest - the output destination for the process output stream (must not be null)
      checker - the process exit code checker to use (must not be null)
      Returns:
      the output destination
    • of

      public static OutputDestination of(ProcessBuilder processBuilder, OutputDestination errorDest, OutputDestination outputDest)
      An output destination that pipes into a process. The process builder's redirection settings will be overwritten. Note that the returned output destination reuses the same process builder and thus is not thread safe.
      Parameters:
      processBuilder - the process builder, which will be reused on every usage (must not be null)
      errorDest - the output destination for the process error stream (must not be null)
      outputDest - the output destination for the process output stream (must not be null)
      Returns:
      the output destination
    • of

      public static OutputDestination of(ProcessBuilder processBuilder, OutputDestination errorDest, OutputDestination outputDest, io.smallrye.common.function.ExceptionConsumer<Process,IOException> checker)
      An output destination that pipes into a process. The process builder's redirection settings will be overwritten. Note that the returned output destination reuses the same process builder and thus is not thread safe.
      Parameters:
      processBuilder - the process builder, which will be reused on every usage (must not be null)
      errorDest - the output destination for the process error stream (must not be null)
      outputDest - the output destination for the process output stream (must not be null)
      checker - the process exit code checker to use (must not be null)
      Returns:
      the output destination