Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package be.kdg.pipes;
- import java.io.IOException;
- import java.nio.file.Files;
- import java.nio.file.Path;
- import java.nio.file.Paths;
- public class Cat {
- public static void main(String[] args) {
- for (String filename : args) {
- Path path = Paths.get(filename);
- if (Files.isRegularFile(path)) {
- try {
- for (String line : Files.readAllLines(path)) {
- System.out.println(line);
- }
- } catch (IOException e) {
- System.err.println("Error: " + e.getMessage());
- }
- } else {
- System.err.println("'" + path + "' is not a regular file.");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment