diff --git a/classpath/java/io/ByteArrayInputStream.java b/classpath/java/io/ByteArrayInputStream.java index ee053f4fe8..56be302f76 100644 --- a/classpath/java/io/ByteArrayInputStream.java +++ b/classpath/java/io/ByteArrayInputStream.java @@ -19,6 +19,19 @@ public class ByteArrayInputStream extends InputStream { } } + public int read(byte[] buffer, int offset, int bufferLength) { + if (position >= length) { + return -1; + } + int remaining = length-position; + if (remaining < bufferLength) { + bufferLength = remaining; + } + System.arraycopy(array, position, buffer, offset, bufferLength); + position += bufferLength; + return bufferLength; + } + public int available() { return length - position; } diff --git a/classpath/java/nio/ByteBuffer.java b/classpath/java/nio/ByteBuffer.java index 38cd1993f6..9aed90f5b5 100644 --- a/classpath/java/nio/ByteBuffer.java +++ b/classpath/java/nio/ByteBuffer.java @@ -201,4 +201,8 @@ public class ByteBuffer { if (position < 0 || position+amount > limit) throw new IndexOutOfBoundsException(); } + + public String toString() { + return "(ByteBuffer with array: " + array + " arrayOffset: " + arrayOffset + " position: " + position + " remaining; " + remaining() + ")"; + } } diff --git a/makefile b/makefile index 8a400218da..36ffe6d5fc 100644 --- a/makefile +++ b/makefile @@ -326,7 +326,9 @@ ifeq ($(platform),windows) else $(cc) $(^) $(lflags) -o $(@) endif +ifneq ($(platform),darwin) @$(strip) --strip-all $(@) +endif @$(show-size) $(@) $(generator): $(generator-objects)