🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2975

Re: Transfer Binary from Server to Client

#2975
From: Richard Wilkman
Date: Wed, 10 Jun 1998 00:00
64 lines
2423 bytes
Hans:

You can't just assume that you'll get all the data across in one
shot.  Most often (after about 2K) there is some interruption.  You
need to change your code so that it looks something like:

while(bytesneeded != bytesRead)
   bytesRead = read();
   
Reverse the process for writing.

-Rich

Hans Georg Frey wrote:
> 
> Hi,
> 
> I have a trusted Applet which should transfer a Word-Document
> from Server to Client. I use the following code:
> 
>       byte byBuffer[] = new byte[1024];
> 
>       urlLink = new URL( "http://" + m_BD.SERVER_NAME + "/" +
> m_BD.SERVER_ROUTE_DIR
>                         + "/" + m_sPrjNummer + "/" + sDateiName );
>       urlCon = urlLink.openConnection();
>       is = urlCon.getInputStream();
>       fos = new FileOutputStream( sDirectory + "/" + sFile );
>       int i = is.read( byBuffer );
>       while( i != -1 )
>       {
>         fos.write( byBuffer );
>         i= is.read( byBuffer );
>       }
>       is.close();
>       fos.close();
> 
> On my developing machine everything works fine, but using a test machine
> with
> Netscape 4.04 and JDK 1.1.4 I get a ccorrupted file. There are
> differnences
> at the beginning and at the end of the file.
> 
> Has anyone a good idea whats wrong? Is there a other way to transport
> binary data? Is the JDK Netscape is using buggy?
> 
> Thank you, by
>   Hans Georg Frey

-- 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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: <357EAFCD.380B039D@inprise.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <357D9E13.FE4@she.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,312b493cb673ac36
X-Google-Attributes: gid1089d0,public
From: Richard Wilkman <rwilkman@inprise.com>
Subject: Re: Transfer Binary from Server to Client
Date: 1998/06/10
Message-ID: <357EAFCD.380B039D@inprise.com>
X-Deja-AN: 361397314
Content-Transfer-Encoding: 7bit
References: <357D9E13.FE4@she.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.api