Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

handling large text files...

Status
Not open for further replies.

kanghao

IS-IT--Management
Jul 4, 2004
68
0
0
KR
I have a large text file sized 1MB or over.

I have to modify just the first or second line and the remaing remains as the same.

I tried LineNumberReader and it works fine.
(read each line and the modify first or the second line
and append them to stringbuffer and toStringed it.)

but I'm wondering there is a better way.
and I want to know the rule of thumb of handling large text files in Java.

Thanks.
 
Use a BufferedReader or a BufferedInputStream ...

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
If you ask for a solution without reading the all the other lines: No.
Only if the numbers of characters doesn't change you may write to absolut positions in the files, without reading the entirely file.

seeking a job as java-programmer in Berlin:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top