Line Number IO : LineNumberReader « File Input Output « Java

Line Number IO


public class LineNumberIOApp {
  public static void main(String args[]) throws IOException {
    FileReader inFile = new FileReader("");
    LineNumberReader inLines = new LineNumberReader(inFile);
    String inputLine;
    while ((inputLine = inLines.readLine()) != null) {
      System.out.println(inLines.getLineNumber() + ". " + inputLine);


Related examples in the same category

1.Create LineNumberReader from FileReader
2.Using the LineNumberReader to read a text file line by line
3.Use LineNumberReader class to read file
4.Split Lines
5.Convert lines into the canonical format, that is, terminate lines with the CRLF sequence.