This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Bug in DataInputStream (readInt)
- To: martin dot kahlert at infineon dot com
- Subject: Re: Bug in DataInputStream (readInt)
- From: Per Bothner <per at bothner dot com>
- Date: Tue, 25 Sep 2001 09:11:45 -0700
- CC: java at gcc dot gnu dot org
- References: <20010925151917.A10416@keksy.muc.infineon.com>
Martin Kahlert wrote:
>So why has this been changed? Is there some deep rewrite of the IO classes
>happening?
>
I don't know if using the helper buf is a good idea or not. My first
intuition is that
it is usually redundant (most of the type the underlying InputStream would
be buffered), and when it isn't, it's probably a tossup whether it makes any
difference.
> I ask, because i want to know if BufferedInputStream::read should
>try harder to obtain all wanted bytes,
>
No.
>Or if DataInputStream should re-call
>BufferedInputStream::read again until it has all the bytes it wants to have.
>
Yes. If it is going to use a buf, it is going to have to do something like
in.readFully(buf, 0, 4) (except of course InputStream doesn't have
readFully).