public final class FromFactory extends Object implements From.Interface<FromCommand>
from
command returning
a new command instance from every signature method.Modifier and Type | Field and Description |
---|---|
static FromFactory |
INSTANCE
The singleton instance of this factory.
|
Modifier and Type | Method and Description |
---|---|
FromCommand |
from(Input input)
Reads from the given input object and redirects the contents into
the next command.
|
FromCommand |
from(InputStream in)
Reads from the given input stream and redirects the contents into
the next command.
|
FromCommand |
from(Iterable<? extends String> lines)
Uses the strings in the specified
input iterable as input
lines for the next command. |
FromCommand |
from(Iterator<? extends String> iterator)
Uses the strings returned by the specified iterator as input
lines for the next command.
|
FromCommand |
from(Reader reader)
Uses the given reader and redirects the read input into the next
command.
|
FromCommand |
from(Stream<? extends String> stream)
Uses the strings returned by the specified stream as input
lines for the next command.
|
FromCommand |
from(URL url)
Reads from the given URL and redirects the contents into the next
command.
|
FromCommand |
fromFile(File file)
Redirects the contents of the given file into the next command.
|
FromCommand |
fromFile(String path)
Redirects the contents of the given file into the next command.
|
FromCommand |
fromResource(Class<?> base,
String resource)
Reads from the given resource relative to the classpath and
redirects the contents into the next command.
|
FromCommand |
fromResource(String resource)
Reads from the given resource relative to the classpath and
redirects the contents into the next command.
|
FromCommand |
fromString(String string)
Uses the given string as input for the next command.
|
FromCommand |
fromStrings(String... strings)
Uses the given strings as input for the next command.
|
public static final FromFactory INSTANCE
public FromCommand fromString(String string)
From.Interface
fromString
in interface From.Interface<FromCommand>
string
- the string to use as input<R>
defined by the implementing class;
the command itself returns no value and writes its result to the
standard output; see class level parameter comments for more
detailspublic FromCommand fromStrings(String... strings)
From.Interface
fromStrings
in interface From.Interface<FromCommand>
strings
- the input lines<R>
defined by the implementing class;
the command itself returns no value and writes its result to the
standard output; see class level parameter comments for more
detailspublic FromCommand from(Iterable<? extends String> lines)
From.Interface
input
iterable as input
lines for the next command. Each string usually represents a single
line of the input; however, if any of the strings contains line
ending codes (UNIX or DOS independent from the host operating
system), it is split into multiple lines.from
in interface From.Interface<FromCommand>
lines
- collection with input lines<R>
defined by the implementing class;
the command itself returns no value and writes its result to the
standard output; see class level parameter comments for more
detailspublic FromCommand from(Iterator<? extends String> iterator)
From.Interface
from
in interface From.Interface<FromCommand>
iterator
- iterator returning input lines<R>
defined by the implementing class;
the command itself returns no value and writes its result to the
standard output; see class level parameter comments for more
detailspublic FromCommand from(Stream<? extends String> stream)
From.Interface
from
in interface From.Interface<FromCommand>
stream
- stream of input lines<R>
defined by the implementing class;
the command itself returns no value and writes its result to the
standard output; see class level parameter comments for more
detailspublic FromCommand fromFile(String path)
From.Interface
path > ...
fromFile
in interface From.Interface<FromCommand>
path
- the file to use as input; wildcards * and ? are supported; relative
paths are resolved on the basis of the current working directory.<R>
defined by the implementing class;
the command itself returns no value and writes its result to the
standard output; see class level parameter comments for more
detailspublic FromCommand fromFile(File file)
From.Interface
file > ...
fromFile
in interface From.Interface<FromCommand>
file
- the file to use as input; relative paths are not resolved (use the
string path argument to enable relative path resolving based on the
current working directory).<R>
defined by the implementing class;
the command itself returns no value and writes its result to the
standard output; see class level parameter comments for more
detailspublic FromCommand fromResource(String resource)
From.Interface
Class.getResourceAsStream(String)
.fromResource
in interface From.Interface<FromCommand>
resource
- a path to the file to redirect to the next command. The resource needs
to be on the classpath. If the file is in the root directory, the
filename should be prefixed with a forward slash. e.g.:
"/test-file.txt"
.
If the file is in a package, then the package should be specified
prefixed with a forward slash, and with each dot "." replaced with a
forward slash. e.g.:
"/org/company/mypackage/test-file.txt"
.
A base
class operand can be provided for relative paths; see
Class.getResourceAsStream(String)
for details about
resource loading.
<R>
defined by the implementing class;
the command itself returns no value and writes its result to the
standard output; see class level parameter comments for more
detailspublic FromCommand fromResource(Class<?> base, String resource)
From.Interface
Class.getResourceAsStream(String)
.fromResource
in interface From.Interface<FromCommand>
base
- base class for subsequent resource
operand if relative paths are used.resource
- a path to the file to redirect to the next command. The resource needs
to be on the classpath. If the file is in the root directory, the
filename should be prefixed with a forward slash. e.g.:
"/test-file.txt"
.
If the file is in a package, then the package should be specified
prefixed with a forward slash, and with each dot "." replaced with a
forward slash. e.g.:
"/org/company/mypackage/test-file.txt"
.
A base
class operand can be provided for relative paths; see
Class.getResourceAsStream(String)
for details about
resource loading.
<R>
defined by the implementing class;
the command itself returns no value and writes its result to the
standard output; see class level parameter comments for more
detailspublic FromCommand from(InputStream in)
From.Interface
from
in interface From.Interface<FromCommand>
in
- the input stream to read from<R>
defined by the implementing class;
the command itself returns no value and writes its result to the
standard output; see class level parameter comments for more
detailspublic FromCommand from(Reader reader)
From.Interface
from
in interface From.Interface<FromCommand>
reader
- the reader used to read the input<R>
defined by the implementing class;
the command itself returns no value and writes its result to the
standard output; see class level parameter comments for more
detailspublic FromCommand from(URL url)
From.Interface
from
in interface From.Interface<FromCommand>
url
- the URL to read from<R>
defined by the implementing class;
the command itself returns no value and writes its result to the
standard output; see class level parameter comments for more
detailspublic FromCommand from(Input input)
From.Interface
from
in interface From.Interface<FromCommand>
input
- the input object to read from<R>
defined by the implementing class;
the command itself returns no value and writes its result to the
standard output; see class level parameter comments for more
detailsCopyright © 2024. All rights reserved.