IndexOutOfBoundsException e
Wasup y'all
My problem is, I have a class (DecodingClassLoader) that calls a method (readStreamToBuffer(InputStream is)) from another class (FileUtiities). Below is the line in the DecodingClassLoader class
classBytes = FileUtilities.readStreamToBuffer( is );
Now, at runtime, when i input the filename on which readStreamToBuffer will act, everything goes well. An attempt to repeat this process without first exiting and restarting the application results in a IndexOutOfBounds exception.
Below is the code segment within the FileUtilities class that generates this exception
while (( bytesReadInPass = is.read( retVal , totalBytesRead , BUFFER_EXTENT_SIZE ) ) >= BUFFER_EXTENT_SIZE){
totalBytesRead += bytesReadInPass;
// Expand the buffer by BUFFER_EXTENT_SIZE
byte[] tmpBuf =newbyte[ retVal.length + BUFFER_EXTENT_SIZE ];
System.arraycopy( retVal , 0 , tmpBuf , 0 , retVal.length );
retVal = tmpBuf;
}
please help!

