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
Oliver Wong - 19 Oct 2005 18:21 GMT
> Hi everybody,
>
[quoted text clipped - 6 lines]
>
> thanks
Try searching for "Serialization", "Serializable", "Serialize" and other
varations on the term.
- Oliver
Monique Y. Mudama - 19 Oct 2005 18:25 GMT
> Hi everybody,
>
[quoted text clipped - 8 lines]
>
> Marcelo
Try searching on the word 'serialize'

Signature
monique
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Steve Horsley - 19 Oct 2005 21:39 GMT
> Hi everybody,
>
[quoted text clipped - 8 lines]
>
> Marcelo
java.io.ObjectOutputStream
java io.ObjectInputStream
Steve
Roedy Green - 19 Oct 2005 23:28 GMT
>I am searching the web in order to find how to write objects (Vector
>objects) inside a file.
The term you are looking for is serialization.
See http://mindprod.com/jgloss/serialization.html
for sample code generated see
http://mindprod.com/applets/fileio.html
and tell it you want to read/write serialised objects.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
Marcelo - 20 Oct 2005 09:53 GMT
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
Thomas Weidenfeller - 20 Oct 2005 11:26 GMT
> 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

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Roedy Green - 20 Oct 2005 12:08 GMT
>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.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.