🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Random Access File

#17856
From: Brian Burton
Date: Fri, 11 Sep 1998 00:00
32 lines
1418 bytes
Sam C. King wrote:
> 
> I have tried in vane, just about everything I can think
> of to create the simple file outlined in deitel's book
> on p777, with no luck.
> 
> From what I've read, I really thought that the following
> was going to work:
> 
> String s1 = "abc";
> byte[] b1 = new byte[15];
> b1 = s1.getBytes();
> raf.write(b1,0,15);
> 

b1 is not a 15 byte array.  When you assigned 

  b1 = s1.getBytes()

you replaced your 15 byte array with a 3 character array.  That is the
source of your problem.

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: <35F95D68.A85535AB@burton-computer.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35D62B58.DF97BDCA@olypen.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,2ac3827aa401f7bc
X-Google-Attributes: gidf74b3,public
From: Brian Burton <brian@burton-computer.com>
Subject: Re: Random Access File
Date: 1998/09/11
Message-ID: <35F95D68.A85535AB@burton-computer.com>
X-Deja-AN: 390174631
Content-Transfer-Encoding: 7bit
References: <35D62B58.DF97BDCA@olypen.com>
Content-Type: text/plain; charset=us-ascii
Organization: Burton Computer Corporation
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language