Writing And Reading Objects

L

Loopy

I'm trying to simulate a deck of trading cards and want to write the
entire deck to a data file on the hard drive. I have the following
hierarchy:

ICard (Interface)
Card (Implements above interface, abstract representation of a card)

Each playing card would then override the Card class, storing its own
information. I can successfully create objects of, say
AnExampleDragonCard and add these objects to a Vector. I write the
vector to a datafile via the ObjectOutputStream class. I get no
errors.

When I read the object in via the ObjectInputStream, I get a
StreamCorrupted error. Does anyone know why this may be happening,
given the info I have provided?

Johnny Ooi (Loopy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top