I am reading an InputStream (fis) from a source and on which I have to do some multiple search. I am using Scanner class and I instantiate it after every search. But it works on
Because you've already read the stream to EOS counting lines the first time. So when you do it again there are zero lines left to count, so you get zero.