|
Append Existing file in Java
|
|
04-19-2009, 12:15 AM
Post: #1
|
|||
|
|||
|
Append Existing file in Java
Hi,
Pls advise can i append an existing file in Java , If yes then How ? Pls Explain. |
|||
|
04-19-2009, 12:16 AM
Post: #2
|
|||
|
|||
|
RE: Append Existing file in Java
Appending data to a file is a fairly common task. You'll be surprised to know that there was no support for file appending in JDK1.02, and developers supporting that platform are forced to re-write the entire file to a temporary file, and then overwrite the original. As most users support either JDK1.1 or the Java 2 platform, you'll probably be able to use the following FileOutputStream constructor to append data:
public FileOutputStream(String name, boolean append) throws FileNotFoundException Parameters: name - the system-dependent file name append - if true, then bytes will be written to the end of the file rather than the beginning For example, to append the file 'autoexec.bat' to add a new path statement on a Wintel machine, you could do the following: FileOutputStream appendedFile = new FileOutputStream ("c:\\autoexec.bat", true); |
|||
|
01-30-2010, 03:24 PM
Post: #3
|
|||
|
|||
|
RE: Append Existing file in Java
Appending data to a file is a fairly common task. You'll be surprised to know that there was no support for file appending in JDK1.02, and developers supporting that platform are forced to re-write the entire file to a temporary file, and then overwrite the original. As most users support either JDK1.1 or the Java 2 platform.
Learn dancing |
|||
|
02-03-2010, 12:28 AM
Post: #4
|
|||
|
|||
|
RE: Append Existing file in Java
You can easily append data to the end of the text file by using the Java FileWriter and BufferedWriter classes. In particular, the most important part of the solution is to invoke the FileWriter constructor in the proper manner.
Black leather bags |
|||
|
« Next Oldest | Next Newest »
|

Search
Member List
Calendar
Help


