Package org.qbicc.machine.tool.process
Class InputSource
java.lang.Object
org.qbicc.machine.tool.process.InputSource
A reusable source for input.
-
Method Summary
Modifier and TypeMethodDescriptionstatic InputSourceempty()An input source which is empty.static <T> InputSourcefrom(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> InputSourcefrom(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.static InputSourcefrom(io.smallrye.common.function.ExceptionConsumer<OutputStream, IOException> consumer) An input source which provides input from the output of the given consumer.static InputSourcefrom(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> InputSourcefrom(io.smallrye.common.function.ExceptionFunction<T, InputStream, IOException> supplier, T param) An input source which provides input from the given supplier.static <T> InputSourcefrom(io.smallrye.common.function.ExceptionFunction<T, Reader, IOException> supplier, T param, Charset charset) An input source which provides input from aReaderprovided by the given supplier, using the given character set for byte-encoded destinations.static InputSourcefrom(io.smallrye.common.function.ExceptionSupplier<InputStream, IOException> supplier) An input source which provides input from the given supplier.static InputSourcefrom(io.smallrye.common.function.ExceptionSupplier<Reader, IOException> supplier, Charset charset) An input source which provides input from aReaderprovided by the given supplier, using the given character set for byte-encoded destinations.static InputSourceAn input source which provides input from the given file path.static InputSourcefrom(CharSequence string) An input source which provides input from the given string, using UTF-8 for byte-encoded destinations.static InputSourcefrom(CharSequence string, Charset charset) An input source which provides input from the given string, using the given character set for byte-encoded destinations.static InputSourceAn input source which provides input from the given file path.abstract StringtoString()abstract voidtransferTo(OutputDestination destination) Execute a transfer of this source to the given destination.
-
Method Details
-
empty
An input source which is empty.- Returns:
- the empty input source
-
from
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 benull)charset- the character set (must not benull)- Returns:
- the input source
-
from
An input source which provides input from the given string, using UTF-8 for byte-encoded destinations.- Parameters:
string- the string (must not benull)- 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 aReaderprovided 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 benull)param- the parameter to pass to the suppliercharset- the character set (must not benull)- 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 aReaderprovided by the given supplier, using the given character set for byte-encoded destinations.- Parameters:
supplier- the reader supplier (must not benull)charset- the character set (must not benull)- 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 benull)param- the parameter to pass to the consumercharset- the character set (must not benull)- 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 benull)charset- the character set (must not benull)- Returns:
- the input source
-
from
An input source which provides input from the given file path.- Parameters:
path- the source path (must not benull)- Returns:
- the input source
-
from
An input source which provides input from the given file path.- Parameters:
file- the source file (must not benull)- 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 benull)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 benull)- 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 benull)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 benull)- Returns:
- the input source
-
transferTo
Execute a transfer of this source to the given destination.- Parameters:
destination- the destination to send this input to (must not benull)- Throws:
IOException- if the transfer fails completely or partially
-
toString
-