Scala-Version 2.11.8
Java-Version 1.8
Code: Select all
try(Stream stream = Files.lines(Paths.get("somefile.txt"))){
stream.forEach(System.out::println); // will do business process here
}catch (IOException e) {
e.printStackTrace(); // will handle failure case here
}
Ich bin mir nicht sicher, wo das Problem liegt. Bin neu in der Verwendung von Java NIO, daher bin ich für jede Hilfe sehr dankbar.
Mobile version