Skip to content
Permalink
Browse files

fix: Incorrect return value for bytes [128-255] in stream.read (#1349)

values between [128-255] previously returned integers in range [4294967168, 4294967295].
  • Loading branch information...
davecramer committed Nov 23, 2018
1 parent 0ed0e8f commit 325e63b4c8b7f0c923e8cb9b73795672f21c1fe5
@@ -76,7 +76,7 @@ public int available() throws IOException {

public int read() throws IOException {
checkClosed();
return gotBuf() ? buf[at++] : -1;
return gotBuf() ? (buf[at++] & 0xFF) : -1;
}

public int read(byte[] buf) throws IOException {
@@ -113,7 +113,7 @@ public int read() throws IOException {
while (res != -1) {
res = read(oneByte);
if (res > 0) {
return oneByte[0];
return (oneByte[0] & 0xFF);
}
}
return -1;

0 comments on commit 325e63b

Please sign in to comment.
You can’t perform that action at this time.