Knut Anders Hatlen <[EMAIL PROTECTED]> writes:
> I can't answer your question, but I will add that I find much of the
> code that uses ArrayInputStream very confusing. ArrayInputStream is
> supposed to wrap a byte array to provide encapsulation and easy access
> to the data through the InputStream interface. However, many (most?)
> of the callers inline the accesses to the data (presumably for
> performance reasons), so we end up with lots of methods looking like
> this:
>
> public X readSomething(ArrayInputStream ais, byte[] data, int offset...) {
> // lots of direct manipulation of the byte array
> // ...
> // ...
> // ...
> // finally, make sure that the state of the stream is brought to a
> // consistent state:
> ais.setPosition(offset + numberOfManipulatedBytes);
> }
>
> Both the byte array and the offset are part of the ArrayInputStream
> class, so having all three of them in the parameter list feels a bit
> ugly. And if we need to manipulate the internal state directly that
> often, perhaps an InputStream is not the best data structure in the
> first place?
I tend to agree. I just finished running derbyall with the checks
replaced by ASSERTs and I saw no failures. So unless I hear strong
objections I'll create a Jira for this change.
--
dt