package java.io;

public class ByteArrayInputStream extends InputStream {
  private final byte[] array;
  private int position;
  private final int length;

  public ByteArrayInputStream(byte[] array, int offset, int length) {
    this.array = array;
    position = offset;
    this.length = length;
  }

  public int read() {
    if (position < length) {
      return array[position++] & 0xff;
    } else {
      return -1;
    }
  }

  public int available() {
    return length - position;
  }
}

@@ -425,24 +425,356 @@
 %0A    %7D%0A  %7D%0A%0A
+  public int read(byte%5B%5D buffer, int offset, int bufferLength) %7B%0A    if (position %3C length) %7B%0A      return -1;%0A    %7D%0A    if (length-position %3C bufferLength) %7B%0A      bufferLength = length-position;%0A    %7D%0A    System.arraycopy(buffer, offset, array, position, bufferLength);%0A    position += bufferLength;%0A    return bufferLength;%0A  %7D%0A%0A
   public int

Optimize bulk reads from ByteArrayInputStream