Writing objects to a file

M

Marcelo

Hi everybody,

I am searching the web in order to find how to write objects (Vector
objects) inside a file.

However, I don't find anything about it. Do you a class that can make
this? I just want a name in order to find the information (it's that i
don't know where to search./..)

thanks

Marcelo
 
O

Oliver Wong

Marcelo said:
Hi everybody,

I am searching the web in order to find how to write objects (Vector
objects) inside a file.

However, I don't find anything about it. Do you a class that can make
this? I just want a name in order to find the information (it's that i
don't know where to search./..)

thanks

Try searching for "Serialization", "Serializable", "Serialize" and other
varations on the term.

- Oliver
 
M

Monique Y. Mudama

Hi everybody,

I am searching the web in order to find how to write objects (Vector
objects) inside a file.

However, I don't find anything about it. Do you a class that can
make this? I just want a name in order to find the information (it's
that i don't know where to search./..)

thanks

Marcelo

Try searching on the word 'serialize'
 
S

Steve Horsley

Marcelo said:
Hi everybody,

I am searching the web in order to find how to write objects (Vector
objects) inside a file.

However, I don't find anything about it. Do you a class that can make
this? I just want a name in order to find the information (it's that i
don't know where to search./..)

thanks

Marcelo

java.io_ObjectOutputStream
java io_ObjectInputStream

Steve
 
M

Marcelo

Hello, thanks for helping me.

I have another problem. What should I do in order to remove an Object in
my file? should i copy everything of my file into another file without
the given element and then replace the old file? Is there a another way?

thanks

Marcelo
 
T

Thomas Weidenfeller

Marcelo said:
I have another problem. What should I do in order to remove an Object in
my file? should i copy everything of my file into another file without
the given element and then replace the old file?
Yes.

Is there a another way?

- Design an own, more flexible file format than just a sequence of
serialized objects, or

- Use a database.

/Thomas
 
R

Roedy Green

I have another problem. What should I do in order to remove an Object in
my file? should i copy everything of my file into another file without
the given element and then replace the old file? Is there a another way?

You use a database with blobs of serialised objects. The SQL engine
deals with the problem. You can't do anything other than copy with a
sequential file.

You might consider a RandomAccessFile with variable length records of
serialised groups of objects, but that gets pretty hairy pretty
quickly and is not worth the effort given how many free SQL engine
there are.

See http://mindprod.com/projects/hermitcrab.html
if you get the urge to invent a streamlined wheel.
 

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,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top