Suppai
asked on
Is there a way to set the reading position of a BufferedReader to the first line?
When reading the contents of an URL using a BufferedReader as shown below, how does one reset the reader so that it is at line when finished reading the document?
URL url = new URL(urlString);
BufferedReader urlReader = new BufferedReader(new InputStreamReader(url.open Stream())) ;
Or might I as well just reinitialize the reader, I would think that reinitializing was an inefficient (ressource costly) way to do it?:
BufferedReader urlReader = new BufferedReader(new InputStreamReader(url.open Stream())) ;
URL url = new URL(urlString);
BufferedReader urlReader = new BufferedReader(new InputStreamReader(url.open
Or might I as well just reinitialize the reader, I would think that reinitializing was an inefficient (ressource costly) way to do it?:
BufferedReader urlReader = new BufferedReader(new InputStreamReader(url.open
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok Ill just read again, the mark and reset system seemed to be a bit clumsy.
thats incorrect, it is inefficient.
You might want to think about downloading the page and store a copy of the bytes locally if you are going to be wanting to read it again.
Heres an example of one way to store the contents
http://helpdesk.objects.com.au/java/how-to-write-get-response-to-byte-array
Exactly how you implement it depends on your requirements