Skip to content

Commit e507419

Browse files
committed
add cat method with Path parameter
1 parent 496f692 commit e507419

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main/java/io/github/benas/unixstream/UnixStream.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,19 @@ static UnixStream<String> cat() throws IOException {
4646
* @throws IOException thrown if an error occurs during reading the file
4747
*/
4848
static UnixStream<String> cat(final String filePath) throws IOException {
49+
return cat(Paths.get(filePath));
50+
}
51+
52+
/**
53+
* Create a new UnixStream of lines of the given file.
54+
*
55+
* @param filePath the absolute file path
56+
* @return a new UnixStream of lines of the given file.
57+
* @throws IOException thrown if an error occurs during reading the file
58+
*/
59+
static UnixStream<String> cat(final Path filePath) throws IOException {
4960
Objects.requireNonNull(filePath, "The file path must not be null");
50-
return new UnixStreamImpl<>(lines(Paths.get(filePath)));
61+
return new UnixStreamImpl<>(lines(filePath));
5162
}
5263

5364
/**

0 commit comments

Comments
 (0)