Class InputSource

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

public abstract class InputSource extends Object
A reusable source for input.
  • Method Summary

    Modifier and Type
    Method
    Description
    An input source which is empty.
    static <T> InputSource
    from(io.smallrye.common.function.ExceptionBiConsumer<T,OutputStream,IOException> consumer, T param)
    An input source which provides input from the output of the given consumer.
    static <T> InputSource
    from(io.smallrye.common.function.ExceptionBiConsumer<T,Writer,IOException> consumer, T param, Charset charset)
    An input source which provides input from the output of the given consumer, using the given character set for byte-encoded destinations.
    from(io.smallrye.common.function.ExceptionConsumer<OutputStream,IOException> consumer)
    An input source which provides input from the output of the given consumer.
    from(io.smallrye.common.function.ExceptionConsumer<Writer,IOException> consumer, Charset charset)
    An input source which provides input from the output of the given consumer, using the given character set for byte-encoded destinations.
    static <T> InputSource
    from(io.smallrye.common.function.ExceptionFunction<T,InputStream,IOException> supplier, T param)
    An input source which provides input from the given supplier.
    static <T> InputSource
    from(io.smallrye.common.function.ExceptionFunction<T,Reader,IOException> supplier, T param, Charset charset)
    An input source which provides input from a Reader provided by the given supplier, using the given character set for byte-encoded destinations.
    from(io.smallrye.common.function.ExceptionSupplier<InputStream,IOException> supplier)
    An input source which provides input from the given supplier.
    from(io.smallrye.common.function.ExceptionSupplier<Reader,IOException> supplier, Charset charset)
    An input source which provides input from a Reader provided by the given supplier, using the given character set for byte-encoded destinations.
    from(File file)
    An input source which provides input from the given file path.
    An input source which provides input from the given string, using UTF-8 for byte-encoded destinations.
    from(CharSequence string, Charset charset)
    An input source which provides input from the given string, using the given character set for byte-encoded destinations.
    from(Path path)
    An input source which provides input from the given file path.
    abstract String
     
    abstract void
    Execute a transfer of this source to the given destination.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • empty

      public static InputSource empty()
      An input source which is empty.
      Returns:
      the empty input source
    • from

      public static InputSource from(CharSequence string, Charset charset)
      An input source which provides input from the given string, using the given character set for byte-encoded destinations.
      Parameters:
      string - the string (must not be null)
      charset - the character set (must not be null)
      Returns:
      the input source
    • from

      public static InputSource from(CharSequence string)
      An input source which provides input from the given string, using UTF-8 for byte-encoded destinations.
      Parameters:
      string - the string (must not be null)
      Returns:
      the input source
    • from

      public static <T> InputSource from(io.smallrye.common.function.ExceptionFunction<T,Reader,IOException> supplier, T param, Charset charset)
      An input source which provides input from a Reader provided by the given supplier, using the given character set for byte-encoded destinations.
      Type Parameters:
      T - the type of the parameter
      Parameters:
      supplier - the reader supplier (must not be null)
      param - the parameter to pass to the supplier
      charset - the character set (must not be null)
      Returns:
      the input source
    • from

      public static InputSource from(io.smallrye.common.function.ExceptionSupplier<Reader,IOException> supplier, Charset charset)
      An input source which provides input from a Reader provided by the given supplier, using the given character set for byte-encoded destinations.
      Parameters:
      supplier - the reader supplier (must not be null)
      charset - the character set (must not be null)
      Returns:
      the input source
    • from

      public static <T> InputSource from(io.smallrye.common.function.ExceptionBiConsumer<T,Writer,IOException> consumer, T param, Charset charset)
      An input source which provides input from the output of the given consumer, using the given character set for byte-encoded destinations.
      Type Parameters:
      T - the type of the parameter
      Parameters:
      consumer - the consumer (must not be null)
      param - the parameter to pass to the consumer
      charset - the character set (must not be null)
      Returns:
      the input source
    • from

      public static InputSource from(io.smallrye.common.function.ExceptionConsumer<Writer,IOException> consumer, Charset charset)
      An input source which provides input from the output of the given consumer, using the given character set for byte-encoded destinations.
      Parameters:
      consumer - the consumer (must not be null)
      charset - the character set (must not be null)
      Returns:
      the input source
    • from

      public static InputSource from(Path path)
      An input source which provides input from the given file path.
      Parameters:
      path - the source path (must not be null)
      Returns:
      the input source
    • from

      public static InputSource from(File file)
      An input source which provides input from the given file path.
      Parameters:
      file - the source file (must not be null)
      Returns:
      the input source
    • from

      public static <T> InputSource from(io.smallrye.common.function.ExceptionFunction<T,InputStream,IOException> supplier, T param)
      An input source which provides input from the given supplier.
      Type Parameters:
      T - the type of the parameter
      Parameters:
      supplier - the input supplier (must not be null)
      param - the parameter to pass to the supplier
      Returns:
      the input source
    • from

      public static InputSource from(io.smallrye.common.function.ExceptionSupplier<InputStream,IOException> supplier)
      An input source which provides input from the given supplier.
      Parameters:
      supplier - the input supplier (must not be null)
      Returns:
      the input source
    • from

      public static <T> InputSource from(io.smallrye.common.function.ExceptionBiConsumer<T,OutputStream,IOException> consumer, T param)
      An input source which provides input from the output of the given consumer.
      Type Parameters:
      T - the type of the parameter
      Parameters:
      consumer - the consumer (must not be null)
      param - the parameter to pass to the consumer
      Returns:
      the input source
    • from

      public static InputSource from(io.smallrye.common.function.ExceptionConsumer<OutputStream,IOException> consumer)
      An input source which provides input from the output of the given consumer.
      Parameters:
      consumer - the consumer (must not be null)
      Returns:
      the input source
    • transferTo

      public abstract void transferTo(OutputDestination destination) throws IOException
      Execute a transfer of this source to the given destination.
      Parameters:
      destination - the destination to send this input to (must not be null)
      Throws:
      IOException - if the transfer fails completely or partially
    • toString

      public abstract String toString()
      Overrides:
      toString in class Object