Minor optimization for ByteArrayInputStream

This commit is contained in:
Eric Scharff 2007-10-30 15:37:46 -06:00
parent 907ce57975
commit b85c643251

View File

@ -23,8 +23,9 @@ public class ByteArrayInputStream extends InputStream {
if (position < length) {
return -1;
}
if (length-position < bufferLength) {
bufferLength = length-position;
int remaining = length-position;
if (remaining < bufferLength) {
bufferLength = remaining;
}
System.arraycopy(array, position, buffer, offset, bufferLength);
position += bufferLength;