Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

re-read a file

Posted on 2006-11-02
2
Medium Priority
?
283 Views
Last Modified: 2008-03-10
Hi all:

I want to open a file on the web site, copy the file to my pc, and then, read it again to do something else. Now my question is: is there anyway I can re-open the web file to read it again without having to re-declare all those streams, readers, etc.? My code is like the following:

URL u = new URL(webFilePath + fileName);
InputStream in = u.openStream();            
in = new BufferedInputStream(in);
Reader isr = new InputStreamReader(in);
BufferedReader br = new BufferedReader(isr);

//copy the file
....
br.close();

//read the file again, this time parse the line read and do something
??

Is there any way I can avoid re-declaring everything? It's no big deal to do that, but if there're smarter way to do things, I want to know.

Thanks.
0
Comment
Question by:sdc248
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 17860952
See BufferedReader.mark and BufferedReader.reset
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17861798
:-)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question