Results 1 to 2 of 2
- 09-27-2008, 12:08 PM #1
Member
- Join Date
- Sep 2008
- Posts
- 2
- Rep Power
- 0
Saving and updating a single file
Hey everyone.
I'm trying to make it possible to save program data into a single file in a way.
The problem is that I want to save multiple entries and load any one them at any time through my program but each time I save a new entry, instead of adding it as a second entry, it overwrites the existing one.
Here's my code:
private void SaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_SaveActionPerformed
Vector<PointOnFret> vectorToSave = gPanel1.getFretPointsVector();
String chordName = JOptionPane.showInputDialog("Enter chord name");
Chord chordToSave = new Chord();
chordToSave.setName(chordName);
chordToSave.setPositions(vectorToSave);
try{
FileOutputStream fis = new FileOutputStream(FILENAME) ;
ObjectOutputStream out = new ObjectOutputStream(fis) ;
out.write(chordToSave);
out.flush();
out.close();
}
Can you see any problem?
Pls help
- 09-27-2008, 02:42 PM #2
Similar Threads
-
[SOLVED] jfilechooser for saving a file....?
By prabhurangan in forum AWT / SwingReplies: 9Last Post: 03-19-2012, 05:20 PM -
Saving Values
By Sysem in forum New To JavaReplies: 10Last Post: 06-02-2008, 06:29 PM -
Saving data in an XML file
By Thez in forum New To JavaReplies: 1Last Post: 12-08-2007, 09:24 PM -
File Upload - Single to allow the search of .txt files
By Daniel in forum Advanced JavaReplies: 1Last Post: 06-06-2007, 04:20 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks