How to write in a file without erase it each time I want to write inside

Hi
My problem is to write in a unique file without erasing what I have written inside before.
Because I use an Applet and I write some information in afile each time the user push a button but I want to keep all the information, beacause in my case I only have the last information i.e. the last time the user push the button.
My code is:
Below it is the code where I write in the file:
writer2 = new BufferWriter("chemin.txt");
methode = uneMethode;
eps = unEps;
n = unN;
solExacte=uneSolExacte;
y=z;
Date time =new Date();
Vector valeur = new Vector();
valeur.add(new Double(eps));
valeur.add(new Integer(n));
valeur.add(new Integer(solExacte));
valeur.add(new Integer(methode));
String time_string = time.toString();
valeur.add(new String(time_string));
//writing to variables file
BufferWriter writer = new BufferWriter("variables");
writer.write(valeur);
Now it is the class Bufferwriter:
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Vector;
import java.io.File;
public class BufferWriter {
private String fileName;
BufferedWriter w;
public BufferWriter(String name) throws IOException {
fileName=name;
w=new BufferedWriter(new FileWriter(new File(fileName)));
public void write(Vector v) throws IOException {
String string;
for (int i=0; i<5; i++) {
string=((v.get(i)).toString());
w.write(string,0, string.length());
w.newLine();
w.flush();
public void close() throws IOException{
close();}

try
w=new BufferedWriter(new FileWriter(fileName, true));
The Constructor you want is ..
FileWriter
public FileWriter(String fileName,
boolean append)
throws IOException

Similar Messages

  • How can I use mac pro without signing in each time now that Ihave downloaded yosemite

    Yosemite10.how can I use my mac pro without having to sign in each time?

    You may need to unlock System Preferences by clicking on the padlock in the lower left corner.

  • How do I use DC Pro without signing in each time and putting in my serial number?

    Upgrade DC was downloaded and is being used on a Mac with Yosemite operating system as a stand alone program, not through the Cloud.

    I received a different serial number from my Acrobat Pro XI, when I downloaded the Acrobat DC and I purchased it because it was described as an off-line program - see reference below.
    Marci
    Do I have to work with Adobe Document Cloud services if I purchase Acrobat DC?
    No. Acrobat DC desktop software can be used by itself, without taking advantage of Adobe Document Cloud services if desired.
    Do I need to be online to use Acrobat?
    The first time you open Acrobat DC desktop software, you’ll need an Internet connection for software activation. After that, you’ll be able to work offline with ease. If you purchase a subscription, you’ll be asked to log in periodically to verify your credentials (every 30 days if you have a monthly plan versus 99 days with an annual plan). Also, two new Acrobat tools – Send for Signature, and Send & Track – require an online connection

  • I mounted my external hard drive to a pc and now I don't have edit or write permissions on my Mac (read only). How do I get them back without erasing the drive?

    Hello all, I am a photographer and have my portfolio, edited and raw images backed up on a Seagate Free Agent External Hardrive. I mounted my external hard drive to a pc recently and now I don't have edit or write permissions to it on my Mac (read only). How do I get them back without erasing the drive and loosing my valuable work?

    If you re-format it you will lose all the data on it!!!!! So make sure you have backed up the drive or moved all the data on it to another external HD or the internal HD on your iMac.
    Below is an Apple Advice letter that explains how to format an external HD, it's written for Aperture but you can use the instructions to formate any external HD.
    http://support.apple.com/kb/HT3509

  • Hello, I would like to know how I can open a file without downloading it? Thank you

    Hello, I would like to know how I can open a file without downloading it? Thank you

    matrix wrote in message
    news:[email protected]..
    > I tried that, attached is the vi.
    > My actual aim is to allow data to be plotted to the graph 4 24 hours,
    > after which, it should clear the chart and start at the beginning
    > agin.
    > Does this vi do this.
    No. The attached is the simplest way of modifying it to do as you want. I've
    sped things up a little to make it obvious.
    > Will the array be able to keep all the data, is there a way i can do
    > it without arrays, i.e. kind of dynamically, and therefore try to save
    > memory usage.
    You already are. You're making the arrays as you go along so only the memory
    needed for the data that's in the plot is in use at any one time. To do it
    without storing
    arrays at all you'd need to keep retrieving the data from
    the XYgraph, adding the new datapoint and writing it back. Messy and I
    suspect incredibly inefficient.
    You're going to use the memory in any case- a better option would be to
    pre-initialise an array and fill it slowly. At the end of each 24 hour block
    zap all the data and start again without destroying and recreating the
    arrays. Or if you're only doing the 24 hour wipes to save memory, simply
    start again at the start of the buffer woithout erasing the previous data
    and you always have 24 hours of data to liik at once the system's running.
    Do a search for keywords like "pre initialise" or "circular buffer" on
    ni.com
    [Attachment xy-time_modified.vi, see below]
    Attachments:
    xy-time_modified.vi ‏51 KB

  • How to restore a control file without having its backup

    Hi,
    Can any one please suggest me how to restore a control file without having its backup.
    Thanks

    To add to what SB said, in years past the instructions for re-creating the control file manually were contained in the DBA Administration manual. It used to be and may still be common to be taking and saving a "backup control file to trace" for this purpose.
    If you lost only the primary copy of the control file and it is an OS file then while the database is shutdown you can copy the secondary over the primary and then use if to start the database. If the control file is stored in ASM then there should be a way to perform the copy via ASM.
    If you use rman for backups then a copy of the control file should be part of the backup process and you can retrieve it from the backup set then perform recovery using the backup control file though I do note the OP said something to the effect no backup exists. Still, I have knows of instances where the DBA did not realize that the backup set contained the control file and the spfile so I think this is worth mentioning just in case.
    HTH -- Mark D Powell --

  • How can I manage my music without erasing all of my songs?

    For reference I've had iPods since about 2005 and I've been through this many times. My harddrive in my computer recently crashed and I had to replace it. Now all of my songs are gone (other than the ones I got on iTunes obviously). About half of my music (near 500 songs) are off of old CD's that I have since thrown away since I figured I had them saved on my iPhone and my laptop. Reference again: I had this happen when I had an iPod touch also with another computer. With my iPod touch, I was free to manage my music manually without erasing all my songs that were on my iPod. Now why can't I seem to do this now with my iPhone. Please help! I can't loose 500 songs! That's $500 that I DON'T HAVE to spend on music that I've already bought! P.S. I just need to know how to manually manage my music without erasing all my music!

    is this the one you're looking for?
    Managing content manually on iPhone, iPad, and iPod

  • I have my ipod shuffle plugged into a diffrent computer associated with it for ittunes, but i cant figure out how to maually manage my music without erasing all the songs already on my ipod shuffle... so how do i do that?

    I have my ipod shuffle plugged into a diffrent computer associated with it for ittunes, but i cant figure out how to maually manage my music without erasing all the songs already on my ipod shuffle... so how do i do that? I've done it before with my old ipod before it broke. I really need help with this!

    I have my ipod shuffle plugged into a diffrent computer associated with it for ittunes, but i cant figure out how to maually manage my music without erasing all the songs already on my ipod shuffle... so how do i do that? I've done it before with my old ipod before it broke. I really need help with this!

  • Trying to add playlist to iPhone. The current music on my iPhone is synced with another library. How do I add my playlist without erasing all of the music currently on my iPhone?

    Trying to add playlist to iPhone. The current music on my iPhone is synced with another library. How do I add my playlist without erasing all of the music currently on my iPhone?

    iPhone is designed to sync with one computer only, if you sync with another, all your content will be erased and replaced by whatever is on that computer.

  • MAC OSX 10.3.6 having Boot Problems(Gray Screen with Spinning wheel all the Time) ,How to restore all the files without Mac Startpup Disc,still is not possible i want to download full CD from Apple Site, Is It Possible to Download!

    Hi Frnds,Small Favour for me,...
    MAC OSX 10.3.6 having Boot Problem(Gray Screen with Spinning wheel all the Time) ,How to restore all the files without Mac Startpup Disc,still is not possible i want to download full CD from Apple Site, Is It Possible to Download!, Windows 7 is working perfectly , can i restore any files in MAC OSX 10.3.6 through Windows 7, or i need the MAC OSX 10.3.6 Bootable Files i need to enter the MAC OSX....

    Hi Frnds,Small Favour for me,...
    MAC OSX 10.3.6 having Boot Problem(Gray Screen with Spinning wheel all the Time) ,How to restore all the files without Mac Startpup Disc,still is not possible i want to download full CD from Apple Site, Is It Possible to Download!, Windows 7 is working perfectly , can i restore any files in MAC OSX 10.3.6 through Windows 7, or i need the MAC OSX 10.3.6 Bootable Files i need to enter the MAC OSX....

  • Can you write an avi file without using imaq

    Just curious if anybody has tried to write an avi file without using imaq vi's? So far I have only found sketchy info on the file format and am looking for some help on the file structure etc. Any references or example avi files with explanations of format would be most helpfull. Thanks in advance -

    Absolutely.......
    An AVI video file is actually structured in the same way as most Windows media files or RIFF files as they are generically known, thus the description below is applicable to for example WAV files etc.
    Thus the file always begins with the four byte code RIFF and continues to use this generic four byte coding known as FOURCC, four-character code or FCC throughout.
    There are then specific requirements for each different media content and the sections that must be included to define a valid file structure of the desired meadia type.
    Each section or 'CHUNK' is defined by an FCC (RIFF being the first) with facility to include additional FCC's as required. The FCC is followed by a length descriptor and then the data (just for fun the odd CHUNK does not quite fit this very general overview). These chunks then align to even word boundries so padding zeros are often inserted at the end of a CHUNK to make it all nice and neat.
    It is a requirement that software that does not recognise an additional custom CHUNK should ignore it, this is very easy as all you have to do is use the length descriptor to 'jump' over the CHUNK concerned.
    The following is an example from the 'CLOCK.AVI' found on windows computers for a number of years...
    RIFFjB AVI LISTΠhdrlavih8
    Here you can see the RIFF followed by a four byte length descriptor (4 Gigabytes), followed by various sub CHUNKS in this example the sub CHUNK is an AVI (note that it is actually 'AVI ' to conform to the FCC).
    So the CHUNK structure looks a bit like this:-
    RIFF ('AVI '
    LIST ('hdrl'
    'avih'()
    LIST ('strl'
    'strh'()
    'strf'()
    'strd'()
    'strn'()
    LIST ('movi'
    {SubChunk | LIST ('rec '
    SubChunk1
    SubChunk2
    ['idx1']
    For more information on all this you need to read the RIFF specification documentation on the MSDN website or on the MSDN Technet materials. Most of the stuff you will immediately locate will refer to the AVI file format as that is where most of the recent effort has been focused.

  • HT201263 How can I restore my ipod without erasing everything??

    HOW CAN I RESTORE MY IPOD WITHOUT ERASING EVERYTHING?

    You cannot.
    That is what a restore does.  It erases everything and reinstalls the ios.
    If you are using the ipod as designed then everything is on your computer, so you can resync everything,  and you can restore from your backup to get the settings back.

  • How can I retrieve desktop files being erased after updating my computer?

    How can I retrieve desktop files being erased after updating my computer?

    The easiest method would be to restore them from the last Time Machine backup made just prior to the update. 
    Or use a file recovery application to recovery them.  Most have a demo mode so you can determine if it can find the files you need before purchasing it.  Go to MacUpdate.com and do a search for "recover files" to get a list of potential candidates.

  • How do I make pages inactive without erasing them?

    How do I make pages inactive without erasing them?

    You could not include the page in the navigation menu. In the Page Inspector, unselect "Include page in navigation menu". That way it won't be found anywhere on your site.

  • How to compress a pdf file without quality loss

    How to compress a pdf file without quality loss? Please help....

    With the way you worded the question, your only option is to zip (or equivalent) the PDF. There are options in terms of graphic compression (this is generally a loss of quality in reducing the pixels) and nonstorage of fonts (likely making the file unreadable to some). So there are techniques, but with a tradeoff. It all depends on what you mean by loss of quality.
    The other techniques that do not lose quality, but give up on some functionality are to remove links, bookmarks, and tags. The tags are often necessary only for converting a PDF back to another form and maintaining accessibility - important in some business situations. These are all tradeoffs that give something up.

Maybe you are looking for