Storing classes in a RandomAccessFile

Discussion in 'Java' started by jpshahom, Nov 28, 2003.

  1. jpshahom

    jpshahom Guest

    How can I save to disk the various names of classes into a
    RandomAccess File?
    My objective is to assign the value of primitives which I'll be
    reading from disk to differently named classes
    jpshahom, Nov 28, 2003
    #1
    1. Advertising

  2. "jpshahom" <> wrote in message
    news:...

    Before specifically answering your questions I'd like to point out [on the
    off chance you don't already know] that Java supports a form of object
    serialisation [i.e. the converting of objects to storable / transmittable
    form, so allowing them to be later recreated]. This *may* be what you may
    actually require. For more details on its use, see:

    http://java.sun.com/docs/books/tutorial/essential/io/serialization.html

    Ok, now to your questions:

    >
    > How can I save to disk the various names of classes into a
    > RandomAccess File?
    >


    Class names are 'String' types, so you would probably use the 'readUTF' and
    'WriteUTF' methods to read / write this data.

    >
    > My objective is to assign the value of primitives which I'll be
    > reading from disk to differently named classes
    >


    This is easily accomplished using the relevant method [e.g. 'writeDouble',
    'readDouble' etc]. However, you are, of course, referring to reading /
    writing data pertaining to *objects*, are you not ? Again, it sounds like a
    need for object serialisation [though I hope I've not misunderstood your
    question].

    I hope this helps.

    Anthony Borla
    Anthony Borla, Nov 29, 2003
    #2
    1. Advertising

  3. jpshahom

    Roedy Green Guest

    Roedy Green, Nov 29, 2003
    #3
    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. Mike
    Replies:
    0
    Views:
    1,187
  2. Harald Kirsch

    Reader on top of RandomAccessFile

    Harald Kirsch, Aug 21, 2003, in forum: Java
    Replies:
    0
    Views:
    566
    Harald Kirsch
    Aug 21, 2003
  3. ak
    Replies:
    12
    Views:
    2,129
    Roedy Green
    Oct 24, 2003
  4. Christopher Dean

    RandomAccessFile vs. FileChannel

    Christopher Dean, Nov 18, 2003, in forum: Java
    Replies:
    3
    Views:
    1,179
    Michael Borgwardt
    Nov 19, 2003
  5. ak
    Replies:
    6
    Views:
    818
    VisionSet
    Jul 9, 2004
Loading...

Share This Page