LineNumberReader can be handy if we are parsing a text file that can contain errors. LineNumberReader also enables us to reset the current line number to another number, by calling the setLineNumber() method. We can get the current line number by calling the getLineNumber() method. Whenever the LineNumberReader encounters a line terminator by the wrapped Reader, the line number is incremented. Line numbering begins at 0 (similar to array indices). ![]() ![]() LineNumberReader is a subclass of the BufferedReader class and allows us to keep track of which line we are currently processing. For reading a file line by line, the LineNumberReader class could be a perfect choice.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |