473,322 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

how to add more lines to an early created file using FileWriter

I created the file early as
void writeFile(int [] t, String fileName) throws IOException
{
char buffer[];
FileWriter fin = new FileWriter(fileName);
for (int i =0; i < t.length; i++){
String s = String.valueOf(t[i]);
buffer = new char[s.length()];
s.getChars(0,s.length(),buffer, 0);
fin.write(buffer);
fin.write('\n');
}
fin.close();
}

now I want to more lines, to a file already created using above code..
Nov 7 '06 #1
1 1643
r035198x
13,262 8TB
I created the file early as
void writeFile(int [] t, String fileName) throws IOException
{
char buffer[];
FileWriter fin = new FileWriter(fileName);
for (int i =0; i < t.length; i++){
String s = String.valueOf(t[i]);
buffer = new char[s.length()];
s.getChars(0,s.length(),buffer, 0);
fin.write(buffer);
fin.write('\n');
}
fin.close();
}

now I want to more lines, to a file already created using above code..
FileWriter(String fileName, boolean append)
from
http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileWriter.html
Nov 7 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Dave W | last post by:
Hi, I'm hoping for some guideance. I'm trying append to the bottom of a text file using Java. Any advice, further reading would be greatly appreciated! Cheers, Dave
1
by: Alan Fried | last post by:
The following program is supposed to write the lower case letters of the alphabet to a text file. Here is the code: import java.io.*; class createFile4 { public static void main (String...
2
by: Phil Galey | last post by:
I have a FileSystemWatcher that triggers when a PDF file is created. However, the creation of the PDF file is about a 7 or 8 second process ... I cannot refer to the file during that time because...
6
by: gauravkhanna | last post by:
import java.io.*; class Automation1 implements Runnable { int iterationCount=0; Thread t; FileReader fr; //FileWriter fw; BufferedReader br; ...
0
by: nettynet | last post by:
I'm really new in java. I'm trying to read 8000 URL files and write to a file. It's a kind of combining all files together...not overwritten. This is the URL of my all files...
2
by: deeadeed | last post by:
Hey, Im working on a programme and need it to write to file. I put in a file writer it seems to run ok, creates the txt file but doesnt write any data. Heres the code: private void...
2
by: minouparhizkar | last post by:
hi could anyone helping me to finish this i have no idea how to implement the program in java im trying to grabbing the pixel from image and then convert it to the txt file .i did that but it didnt...
9
mickey0
by: mickey0 | last post by:
Hi, I have one problem; I must read a html like this; <html> <body> Hello </body> </html> I read this in a string (correct?) and after I have to do some changes to it and write it on disk...
23
by: andrew | last post by:
Hi, I have been taken to task about the length of lines in the source html of: http://www.slrn.sourceforge.org which, as I commonly do, has no line breaks at all in the source html. My...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.