How to append existing line within a java text file


I'm having trouble adding to an exsisting line in a text file without overwriting that particular line or adding a new line.

for example, i have a line in my text file which is:

hello my name is

I would like to add to this line so it becomes:

hello my name is joe bloggs


<strong>i have a task to create a help desk program and i am trying to incorporate a feature that enables users to edit questions they have posted. as a result, the program will need to be able to append Any line within the text file - not necessarily just the last line</strong>


If it's not at the end of the file, you're in trouble - you're basically talking about <em>inserting</em> data in the middle of a file, which isn't traditionally supported by file systems.

The normal way to approach this is to create a <em>new</em> file - copy the portion before the insertion point from the old file, then write your new data, then copy the remainder of the original file afterwards. Finally, do whatever renaming/deleting you need.


  • Aggregated CMPedometerData (iPhone + Watch total count)
  • Desktop path on mac
  • Serial port - how to perform safe search for my device?
  • Active Directory Account Password Expiration Date with Fine-Grain Password Policy
  • decision boundary of perceptron too small
  • Override method for a collection of classes implementing an interface
  • Redisplay results list on AutoCompleteExtender through javascript
  • Java catching exceptions and subclases
  • EJB @Schedule issue
  • JavaScript Intellisense is not working in Visual Studio 2015
  • Why “propdp” code snippet doesn't use the nameof operator for the name of the registered proper
  • Submission of new app with iAds
  • CORS with socket.io
  • Create function that can pass a parameter without making a new component
  • Memory error in python- how to use more memory
  • Why cepheus don't send int without quotes to orion?
  • C# program and C++ DLL compiled for 32-bit system crash on 64-bit system
  • Differences in dis-assembled C code of GCC and Borland?
  • converting text file into xml using php?
  • Sequential (transactional) API calls in angular 4 with state management
  • Unable to get column index with table.getColumn method using custom table Model
  • custom UITableViewCell with image for highlighting
  • Abort upload large uploads after reading headers
  • ImageMagick, replace semi-transparent white with opaque white
  • NHibernate Validation Localization with S#arp Architecture
  • Algorithm for a smudge tool?
  • java.lang.NoClassDefFoundError: com.parse.Parse$Configuration$Builder on below Lollipop versions
  • What is Eclipse's Declaration View used for?
  • Fetching methods from BroadcastReceiver to update UI
  • Javascript Callbacks with Object constructor
  • Symfony2: How to get request parameter
  • GridView Sorting works once only
  • Comma separated Values
  • Matrix multiplication with MKL
  • WPF Applying a trigger on binding failure
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • how does django model after text[] in postgresql [duplicate]
  • How does Linux kernel interrupt the application?
  • Checking variable from a different class in C#