473,395 Members | 1,797 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,395 software developers and data experts.

File I/O HELP

Hi all

I am trying to implement a save load class for a text based adventure game....
A save file must contain 3 arraylists that each contain user defined objects like the players inventory arrayList, the position of all the characters and items in the rooms of the game world.....
if i manage to write all the arraylists in one file - is this even possible... using append or smthing- then how could i separate them
when i read back the file to load a game????
I 've thought of writting a separate file for each arrayList but i dont think thats a good idea.....

Any pointers?????? HELP
May 5 '07 #1
1 1137
JosAH
11,448 Expert 8TB
Why don't you simply serialize your objects? Lists are already Serializable so
all you have to do is make the objects in the lists Serializable too. It's easy to
do: just add "implements Serializable" to your classes. The interface is empty
so there are no methods to implement.

Wrap an ObjectOutputStream around your OutputStream and write your Lists.
For reading wrap an ObjectInputStream around your InputStream and read your
lists back in again.

kind regards,

Jos
May 5 '07 #2

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

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
9
by: Hans-Joachim Widmaier | last post by:
Hi all. Handling files is an extremely frequent task in programming, so most programming languages have an abstraction of the basic files offered by the underlying operating system. This is...
4
by: dixie | last post by:
Help, I'm really out of my depth here (not unusual I hear you say :-). I have just installed HTML Help in an application. I told it in the Project Properties the path to the help file. I then...
1
by: Tim Marshall | last post by:
I'm putting together my first help file (using Easy Help, http://www.easyhelp.com/). So far, so good. I'm able to use the Help File and Help Context ID to have things from my help file pop up...
6
by: Sushil Prasad | last post by:
I am having problem in displaying the compiled help file. In asp.net app I have link button labeled help. On the users click of this button i do the respose.redirect to the url of the .chm file....
4
by: News | last post by:
Hi Everyone, The attached code creates client connections to websphere queue managers and then processes an inquiry against them. The program functions when it gets options from the command...
8
by: Andrew Robert | last post by:
Hi Everyone. I tried the following to get input into optionparser from either a file or command line. The code below detects the passed file argument and prints the file contents but the...
2
by: quicklearner | last post by:
hi I have made a CHM file and I have linked my .CHM file with the controls on the Form in my application which is made in C# 2005. Its working fine . But I want that if user presses 'F1' then when...
2
by: avanti | last post by:
Hi, I use ClickOnce to publish and install an application in the company. I have a help file for the same in .chm format. It is part of the C# project as a 'content' file. I also tried as...
2
by: hotflash | last post by:
Hi All, I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.