Writing objects to a file

Discussion in 'Java' started by Marcelo, Oct 19, 2005.

  1. Marcelo

    Marcelo Guest

    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
    Marcelo, Oct 19, 2005
    #1
    1. Advertising

  2. Marcelo

    Oliver Wong Guest

    "Marcelo" <> wrote in message
    news:43567dbc$...
    > 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
    Oliver Wong, Oct 19, 2005
    #2
    1. Advertising

  3. On 2005-10-19, Marcelo penned:
    > 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'

    --
    monique

    Ask smart questions, get good answers:
    http://www.catb.org/~esr/faqs/smart-questions.html
    Monique Y. Mudama, Oct 19, 2005
    #3
  4. Marcelo wrote:
    > 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
    Steve Horsley, Oct 19, 2005
    #4
  5. Marcelo

    Marcelo Guest

    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
    Marcelo, Oct 20, 2005
    #5
  6. Marcelo wrote:
    > 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
    --
    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/
    Thomas Weidenfeller, Oct 20, 2005
    #6
  7. Marcelo

    Roedy Green Guest

    On Thu, 20 Oct 2005 10:53:46 +0200, Marcelo <> wrote
    or quoted :

    >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.


    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Again taking new Java programming contracts.
    Roedy Green, Oct 20, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. HNguyen
    Replies:
    4
    Views:
    2,384
    HNguyen
    Dec 21, 2004
  2. Ron Albright

    Writing objects to random file

    Ron Albright, Feb 5, 2004, in forum: Java
    Replies:
    3
    Views:
    390
    Ron Albright
    Feb 5, 2004
  3. Peter Loh
    Replies:
    0
    Views:
    319
    Peter Loh
    Feb 5, 2004
  4. 7stud
    Replies:
    11
    Views:
    668
    Dennis Lee Bieber
    Mar 20, 2007
  5. Nebs Petrovic

    Writing objects to file?

    Nebs Petrovic, Aug 6, 2008, in forum: Ruby
    Replies:
    1
    Views:
    107
    Farrel Lifson
    Aug 6, 2008
Loading...

Share This Page