diff --git a/classpath/java/io/ByteArrayInputStream.java b/classpath/java/io/ByteArrayInputStream.java index ee053f4fe8..d3bbcc686e 100644 --- a/classpath/java/io/ByteArrayInputStream.java +++ b/classpath/java/io/ByteArrayInputStream.java @@ -19,6 +19,18 @@ public class ByteArrayInputStream extends InputStream { } } + public int read(byte[] buffer, int offset, int bufferLength) { + if (position < length) { + return -1; + } + if (length-position < bufferLength) { + bufferLength = length-position; + } + System.arraycopy(buffer, offset, array, position, bufferLength); + position += bufferLength; + return bufferLength; + } + public int available() { return length - position; }