Frage

I am reading a huge txt file inside zip.

GZIPInputStream fstream = new GZIPInputStream(new FileInputStream(zipfile));
BufferedReader breader = new BufferedReader(new InputStreamReader(fstream));

I need to read last n lines, of the file.

Is it possible to do that without readline until eof?

War es hilfreich?

Lösung

Is it possible to do that without readline until eof?

No and well due to the following two reasons:

  1. You cannot read a stream backwards.
  2. You cannot un(g)zip backwards.

Just read the entire stream wherein you ignore the lines which you aren't interested in.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top