Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

corrupted URLConnection.getInputStream()

9 views
Skip to first unread message

Ravi Krishnaswamy

unread,
Dec 2, 2000, 3:00:00 AM12/2/00
to
I have written an applet that needs to fetch a blob of binary data from the
server, and does so using the URL and URLConnection classes as:

URL url = new URL(mContext.applet().getCodeBase(), mQuery);
URLConnection conn = url.openConnection();
conn.setUseCaches(false);
InputStream rawis = conn.getInputStream();

I am finding that in my applet running in NC4.7, jdk1.1.5, if I try to read
the InputStream returned by the URLConnection.getInputStream() call with
methods:

InputStream.read(byte[] array, int start, int length)

or

InputStream.read(byte[] array)

towards the end of the input stream (which is about 70K of binary data, sent
as the MIME type application/octet-stream), the data appears to be bad.
There appear to be extra bytes inserted into the data stream. I have
verified that the blob of data in the InputStream fails a CRC check.

I have found a workaround that seems to hold up so far, but I'm not sure if
it has just postponed the problem to a different situation.
I found that using the

int InputStream.read()

method to read the data byte by byte, I am able to work around the problem.


Has anyone seen anything similar and know of a suggested workaround/fix ?

This works very occasionally in NC4.7 itself. The applet works fine on
IE5.0.


thanks in advance,

-ravi


Paul Ostrowski

unread,
Dec 4, 2000, 3:00:00 AM12/4/00
to
This is a total guess, but it sounds like you might have a
high-word/low-word issue. When you write the data out, try switching the
high and low words, and the high and low bytes of each word. Just a quess,
but it might work. Good luck

Paul Ostrowski

Ravi Krishnaswamy <ra...@sirius.com> wrote in message
news:90c19u$1m...@secnews.netscape.com...

0 new messages