ZipInputStream brokenness
Per Bothner
per@bothner.com
Mon Sep 2 14:09:00 GMT 2002
Adam Megacz wrote:
> I can think of plenty; see the comment at the top of
> gnu.gcj.protocol.http.HttpURLConnection.getHttpHeaders() for a great
> example of how buffering can be bad.
(It's actually gnu.gcj.protocol.http.URLConnection.)
I don't think this code says very much about buffers pro or con.
The current code uses a BufferedInputStream, so it *is*
buffering. The way it keeps doing String concatenation, instead
of using a StringBuffer is a beginner's mistake. Using the
programs current character encoding is obviously incorrect.
And of course using a BufferedReader to extra headers from a
file where you'll use something else to read the rest is
clearly going to be difficult.
In any case, if you are reading a jar file sequentially, you will
definitely want to buffer it, at some level.
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/
More information about the Java
mailing list