--- old/src/java.base/share/classes/java/io/ByteArrayInputStream.java 2018-03-14 11:34:52.000000000 -0700 +++ new/src/java.base/share/classes/java/io/ByteArrayInputStream.java 2018-03-14 11:34:51.000000000 -0700 @@ -142,6 +142,7 @@ * @return the next byte of data, or {@code -1} if the end of the * stream has been reached. */ + @Override public synchronized int read() { return (pos < count) ? (buf[pos++] & 0xff) : -1; } @@ -175,6 +176,7 @@ * {@code len} is negative, or {@code len} is greater than * {@code b.length - off} */ + @Override public synchronized int read(byte b[], int off, int len) { Objects.checkFromIndexSize(off, len, b.length); @@ -194,22 +196,25 @@ return len; } + @Override public synchronized byte[] readAllBytes() { byte[] result = Arrays.copyOfRange(buf, pos, count); pos = count; return result; } - public synchronized int readNBytes(byte[] b, int off, int len) { + @Override + public int readNBytes(byte[] b, int off, int len) { int n = read(b, off, len); return n == -1 ? 0 : n; } + @Override public synchronized long transferTo(OutputStream out) throws IOException { - int pos0 = pos; - out.write(buf, pos, count - pos); + int len = count - pos; + out.write(buf, pos, len); pos = count; - return count - pos0; + return len; } /** @@ -224,6 +229,7 @@ * @param n the number of bytes to be skipped. * @return the actual number of bytes skipped. */ + @Override public synchronized long skip(long n) { long k = count - pos; if (n < k) { @@ -244,6 +250,7 @@ * @return the number of remaining bytes that can be read (or skipped * over) from this input stream without blocking. */ + @Override public synchronized int available() { return count - pos; } @@ -255,6 +262,7 @@ * * @since 1.1 */ + @Override public boolean markSupported() { return true; } @@ -274,6 +282,7 @@ * * @since 1.1 */ + @Override public void mark(int readAheadLimit) { mark = pos; } @@ -283,6 +292,7 @@ * is 0 unless another position was marked or an offset was specified * in the constructor. */ + @Override public synchronized void reset() { pos = mark; } @@ -292,6 +302,7 @@ * this class can be called after the stream has been closed without * generating an {@code IOException}. */ + @Override public void close() throws IOException { }