Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public FileInput(FileInputStream fileStream) {
this.fileInfo = fileStream.toString();
}

public FileInput(InputStream inputStream) {
super(new InputStreamReader(inputStream), false);
this.fileInfo = inputStream.toString();
}

public FileInput(FileDescriptor fileDesc) {
super(new FileReader(fileDesc), true);
this.fileInfo = fileDesc.toString();
Expand Down Expand Up @@ -68,6 +73,10 @@ public static List<FileInput> multiple(List<File> files) {
return multiple(files.stream());
}

public static List<FileInput> multiple(InputStream... streams) {
return Stream.of(streams).map(FileInput::new).collect(Collectors.toList());
}

private static List<FileInput> multiple(Stream<File> files) {
return files.map(FileInput::new).collect(Collectors.toList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ public LineProcessor execute(ExecutionContext context, LineProcessor output) {
final List<File> files = FileUtil.expandFiles(context.getCurrentDirectory(), args.getPaths());
final List<FileInput> inputs = FileInput.multiple(files);
return getFileInputProcessor(inputs, context, output, args);
} else if (args.isStreamsSet()) {
final List<FileInput> inputs = FileInput.multiple(args.getStreams());
return getFileInputProcessor(inputs, context, output, args);
}

//from standard input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
the given {@code regexp} string using case-sensitive comparison.
Line endings are not relevant for the comparison.
</method>
<method args="regexp,streams" usesStandardInput="false">
TBD
</method>
<method args="pattern" usesStandardInput="true">
Filters the input lines from the standard input and writes the
matching lines to the standard output. Every line is matched against
Expand Down Expand Up @@ -148,6 +151,9 @@
not resolved (use the string paths argument to enable relative path
resolving based on the current working directory).
</operand>
<operand name="streams" type="java.io.InputStream...">
TBD
</operand>
<operand name="args" type="String...">
String arguments defining the options and operands for the command.
Options can be specified by acronym (with a leading dash "-") or by
Expand Down