🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: RandomAccessFile

#16114
From: Fotis Jannidis
Date: Thu, 25 Mar 1999 00:00
26 lines
1247 bytes
"E.Perrin" <E.Perrin@rmcnet.fr> wrote:

>
>Y want make a real Random access file with objects
>
>but y dont now how to make a byte array for RandomAccessFile
>with String or other objects.
>

I had the same problem and asked for help. Here is the answer I got
(translation is mine, so are probably all mistakes:)

Read the bytes into an array, then couple it with a 
ByteArrayInputStream. 
Then add an InputStreamReader and you can read the data. 
Something like this: 

byte[] buffer = new byte[1024];
BufferedInputStream in = new BufferedInputStream(
                                          new  InputStreamReader (
                                   new ByteArrayInputStream(buffer)));
// now read the data from BufferedInputStream 
// ...

Hth, 
Fotis
Technical Details
Message-ID: <36fa886e.4178241@news.lrz-muenchen.de>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36f968ed.0@209.66.99.126>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,22a21cb8908f46c8
X-Google-Attributes: gidf74b3,public
From: Fotis.Jannidis@lrz.uni-muenchen.de (Fotis Jannidis)
Subject: Re: RandomAccessFile
Date: 1999/03/25
Message-ID: <36fa886e.4178241@news.lrz-muenchen.de>
X-Deja-AN: 459064405
Distribution: world
References: <36f968ed.0@209.66.99.126>
Organization: Ludwig-Maximilians-Universitaet
Newsgroups: borland.public.jbuilder.java.language