Olá, preciso imprimir a quantidade de linhas de um arquivo de texto. Uma vez fiz isso em C, e o que fiz foi percorrer o arquivo até o fim e contar os \n, que representa, assim como em Java, quebra de linha. Pois bem, em Java, para eu fazer o mesmo, eu devo fazer da mesma forma, ou há alguma forma mais simples ou alguma classe que pode me ajudar?
Read a line of text. A line is considered to be terminated by any one of a line feed (’\n’), a carriage return (’\r’), or a carriage return followed immediately by a linefeed.
Overrides:
readLine in class BufferedReader
Returns:
A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached
Throws:
IOException - If an I/O error occurs[/quote]