🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #17855

Re: RandomAccessFile with Serializable

#17855
From: Brian Burton
Date: Fri, 11 Sep 1998 00:00
34 lines
1964 bytes
Sam C. King wrote:
> 
> How do you combine a RandomAccessFile with Serializable?
>  The purpose is quite simple:
> Let's say that we want to create a random access file consisting
> of an Array of Classes.  Each array element is a class containing:
> Employee Number
> Employee Name
> Employee Balance
> Now we want to set the RandomAccessFile pointer to a particular
> Class element within the Class Array, read in the entire Class
> for that employee with some simple statments from serializable,
> change the data for that employee, and write array element back
> into the file with some simple write statments as in serializable
> write.  This is a simple requirement for C, C++, and just about
> any other language.  Surely Java, with all of its power, can
> deftly handle this little problem.  Yet none of the 22 texts on
> Java that I have here borches the subject.
> Thanks
> Sam       samcking@olypen.com

Serialize to a byte array and write the byte array.  Check out the
ByteArrayOutputStream and ByteArrayInputStream classes.

All the best,
++Brian

-- 
Brian Burton                         mailto:brian@burton-computer.com
Burton Computer Corporation          http://www.burton-computer.com
Custom software development using Java, C++, and CORBA.

    Creators of BC!JNews, the all Java NNTP discussion server.
     "Why just spin a web when you could build a community?"
Technical Details
Message-ID: <35F95DF5.CDF53505@burton-computer.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35D62BE5.88900CE9@olypen.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,fea5eccffba95c50
X-Google-Attributes: gidf74b3,public
From: Brian Burton <brian@burton-computer.com>
Subject: Re: RandomAccessFile with Serializable
Date: 1998/09/11
Message-ID: <35F95DF5.CDF53505@burton-computer.com>
X-Deja-AN: 390168648
Content-Transfer-Encoding: 7bit
References: <35D62BE5.88900CE9@olypen.com>
Content-Type: text/plain; charset=us-ascii
Organization: Burton Computer Corporation
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language