I am trying to read a large file line by line, in java, using NIO library.
But this file also contains headers...
try (Stream<String> stream = Files.lines(Paths.get(schemaFileDir+File.separator+schemaFileNm))){
stream.forEach(s->sch.addRow(s.toString(),file_delim));
}
How do i modify this to skip the first line of the file? Any pointers..?
Use the Stream.skip
method to skip the header line.
try (Stream<String> stream = Files.lines(
Paths.get(
schemaFileDir+File.separator+schemaFileNm)).skip(1)){
// ----
}
Hope this helps!