Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

writing to a .sav file

Options
  • 29-11-2004 2:12pm
    #1
    Registered Users Posts: 488 ✭✭


    Anyone tell me how i can write data to a .sav file in java


Comments

  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    Exactly the same as you would write to any other file.


  • Registered Users Posts: 488 ✭✭lad12


    so can i use DataOutputStream.


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Take a look into linking a java.io.BufferedOutputStream with a java.io.FileOutputStream to control buffer problems.

    Now all we need to know is what exactly the .sav file is going to be? Is it based on an existing file, in which case we're going to have to look into its format, or is it one of your own design you can explain to us...


  • Registered Users Posts: 488 ✭✭lad12


    I just want to write a list of nums to the .sav file file..


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    In that case just hook the DataOutputStream into the FileOutputStream, and use as normal.
    DataOutputStream dos = new DataOutputStream(new FileOutputStream("my.sav"));
    


  • Advertisement
  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    You could use java.io.FileWriter then. It's a simple interface. Just get a string of text (your numbers for example), use FileWriter.write(String s) then FileWriter.flush() and hey presto.


  • Registered Users Posts: 488 ✭✭lad12


    ok cheers


Advertisement