3
I need to access a file on an HTTP server and pull information from two different places inside that file. Right now I can take away just one. My doubt is, I can just do:
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
BufferedReader in2 = new BufferedReader(new InputStreamReader(con.getInputStream()));
whereas
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
or I need to make a new HttpURLConnection
for that reason?
Joper, welcome to [en.so]! You should not reuse Inputstream this way in no way. It may even work depending on how it is implemented, but this can lead to worse errors. For example, when a stream is closed the other will also be closed inadvertently. That being said, I cannot understand exactly what you are doing. Could you edit the question by putting an example of this file? You are reading the same file on two different websites or a file that contains two information?
– utluiz