I have the following code snippet in Java:
HttpURLConnection con = (HttpURLConnection)new URL(url).openConnection();
con.connect();
InputStream stream = con.getInputStream();
BufferedReader file = new BufferedReader(new InputStreamReader(stream));
At this point, I read the file from start to finish, looking for something:
while (true)
{
String line = file.readLine();
if (line == null)
break;
}
Now I want to find something else in the file without opening another URL connection .
For reasons unrelated to this issue, I want to avoid finding both things "in the same file scan."
Questions:
Can I rewind a file with reset?
If so, should it be applied to an object InputStream, to an object, BufferedReaderor both?
If not, should you just close the file and open it again?
If so, should it be applied to an object InputStream, to an object, BufferedReaderor both?
If not, how else can I scroll through the file again without having to read the URL connection again?