Skip to content

Commit

Permalink
Fix broken paste with remote connections, fixes #514
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Apr 8, 2020
1 parent 88c28ae commit df9f1f9
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,20 @@ public synchronized int read(long timeout, boolean isPeek) throws IOException {
return res;
}

@Override
public synchronized int readBuffered(byte[] b) throws IOException {
checkIoException();
int res = wait(readBuffer, 0L);
if (res >= 0) {
res = 0;
while (res < b.length && readBuffer.hasRemaining()) {
b[res++] = (byte) (readBuffer.get() & 0x00FF);
}
}
rewind(readBuffer, writeBuffer);
return res;
}

public synchronized void setIoException(IOException exception) {
this.ioException = exception;
notifyAll();
Expand Down

0 comments on commit df9f1f9

Please sign in to comment.