🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Problem reading InputStream from an URL.

#33
From: Rich Wilkman
Date: Mon, 11 May 1998 00:00
45 lines
2006 bytes
Kiran:

The stream tends to die at around 2k.  You have to wrap it in a while
loop that counts bytes.  This assumes you know how many bytes you need
to read.  Something like:

// bytesRead = number of bytes read
// bytesNeeded = number of bytes needed
// in is an InputStream
// buff is the buffer you are reading into

while(readAlready < bytesNeeded)
 bytesRead += in.read(buff, bytesRead, bytesNeeded - bytesRead);

-Rich

Kiran Deshpande wrote:
> 
> Hi All,
>     I am trying to read contents of a directory (within an applet) by
> opening a URL connection to that directory and then parsing throught the
> output.  I tried to read from the InputStream and am able to read only
> the first 260 bytes.  How can I read the rest of the InputStream bytes?
> What am I doing wrong?
> 
> Thanks in advance
> 
>  Regards
> Kiran

-- 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rich Wilkman
Senior Quality Assurance Engineer
Borland JBuilder Team

If you see something that looks like an opinion up there,
it's mine and mine alone.

Mail sent to me from the newsgroups won't bounce but will
be ignored.  If I have time, I'll respond, but you  have
a better chance if you confine your posts to the newsgroups
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Technical Details
Message-ID: <35576085.19E85921@corp.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <35574A21.C38162B3@incentric.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,f9d23c42a69fabc2
X-Google-Attributes: gidf74b3,public
X-Google-Thread: ff01d,f9d23c42a69fabc2
X-Google-Attributes: gidff01d,public
From: Rich Wilkman <rwilkman@corp.borland.com>
Subject: Re: Problem reading InputStream from an URL.
Date: 1998/05/11
Message-ID: <35576085.19E85921@corp.borland.com>
X-Deja-AN: 352305815
Content-Transfer-Encoding: 7bit
References: <35574A21.C38162B3@incentric.com>
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language,borland.public.jbuilder.applet-issues