harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Wilson <jessewil...@google.com>
Subject Re: [testing] M12 testing on Windows x86
Date Tue, 24 Nov 2009 17:43:05 GMT
On Tue, Nov 24, 2009 at 9:12 AM, Tim Ellison <t.p.ellison@gmail.com> wrote:

> Seems to be caused by a change in the implementation of available() for
> InputStreams on Zip entries.
> The failing code is in
> org.apache.harmony.sound.utils.ProviderService#getProviders(String) when
> it tries to read the whole content using available()...
> <snip>
>   InputStream in = urls.nextElement()
>           .openStream();
>   bytes = new byte[in.available()];
>   in.read(bytes);
>   in.close();
> <snip>

Aahhhh.. gotcha.

> Of course, this is bad form, and when I switch to use the old favourite
> getAllBytesFromStreamAndClose(InputStream) things start working again.


> We can debate whether we should try to improve the available() impl or not.

If we want to be true to the
we can't change it.

public int *available*()
              throws IOException <../../../java/io/IOException.html>

Returns 0 after EOF has been reached, otherwise always return 1.

Programs should not count on this method to return the actual number of
bytes that could be read without blocking.

*Overrides:*available <../../../java/io/FilterInputStream.html#available()> in
class FilterInputStream <../../../java/io/FilterInputStream.html> *Returns:*1
before EOF and 0 after
EOF.*Throws:*IOException<../../../java/io/IOException.html> -
if an I/O error occurs.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message