How to append a new line to beginning of an existing file in java? -


assuming have txt file located in /mypath/sampletext.txt. how append new line beginning of file following in java while preserving original text file's contents?:

string startstr ="--start of file--"; 

looking way without having create intermediary 2nd file , make modifications existing file if possible.

read file contents first, prepend new line contents = newline + contents, write new conent in same file (dont append).


Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -