Wrox Programmer Forums
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 6th, 2006, 06:11 AM
Registered User
Join Date: May 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Editing File


How can I write into a file without replacing its content. For example edit
Hello World
to be
Hello All World.
Note: my original file is huge so I can not read, add, write.

Thanks In advance

Old June 14th, 2006, 06:45 PM
Registered User
Join Date: Jun 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

How can you possibly append to a file, if you can't read/add/write...?

Visit my blog please?
Old June 14th, 2006, 07:04 PM
Authorized User
Join Date: Jun 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts

I know what u mean , i had encountered the same problem where the data i was writing was getting overwritten . This tends to happen when the data to the file is written by several methods spread across a package . U can do one thing u can declare the BufferedWriter as a class variable .Then in the constructor initialize it to the file that u want to write . This can be used till the current object is in the scope

Now when u are done with the writing part u can close the file . Usually this should be done somewhere in the end of the main method to be safe .

Hope this helps

Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing a Text File mh VB.NET 1 December 8th, 2005 02:37 AM
Help.. Editing File.dll Aquilitto Pro PHP 1 September 5th, 2005 07:30 AM
Help.. Editing File.dll Aquilitto C++ Programming 2 August 30th, 2005 09:40 PM
Editing Excel File using oledb ctranjith General .NET 0 August 1st, 2005 09:41 AM
File Editing MattLeek Javascript 4 February 18th, 2004 06:52 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.