Guest User

Untitled

a guest
Nov 25th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. package be.kdg.pipes;
  2.  
  3. import java.io.IOException;
  4. import java.nio.file.Files;
  5. import java.nio.file.Path;
  6. import java.nio.file.Paths;
  7.  
  8. public class Cat {
  9. public static void main(String[] args) {
  10. for (String filename : args) {
  11. Path path = Paths.get(filename);
  12. if (Files.isRegularFile(path)) {
  13. try {
  14. for (String line : Files.readAllLines(path)) {
  15. System.out.println(line);
  16. }
  17. } catch (IOException e) {
  18. System.err.println("Error: " + e.getMessage());
  19. }
  20. } else {
  21. System.err.println("'" + path + "' is not a regular file.");
  22. }
  23. }
  24. }
  25. }
Add Comment
Please, Sign In to add comment