Skip to content

Commit

Permalink
Make InputStreamDecrypter.read() InputStream compliant
Browse files Browse the repository at this point in the history
Convert the read signed integer to unsigned before returning it, because it is the behavior defined in the InputStream interface. It also makes it possible to distinguish between errors and successful read operations.

Fixes #10.
  • Loading branch information
spheroid committed Sep 5, 2023
1 parent cd892b6 commit 5c8e998
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public synchronized int available() throws IOException {
public synchronized int read() throws IOException {
byte[] oneByte = new byte[1];
if (read(oneByte) == 1) {
return oneByte[0];
return oneByte[0] & 0xff;
}
return -1;
}
Expand Down

0 comments on commit 5c8e998

Please sign in to comment.