public int read(byte[] b) throws IOException {
return this.read(b, 0, b.length);
}
public int read(byte[] b, int off, int length) throws IOException {
return this.read(b, off, length, this.impl.getTimeout());
}
int read(byte[] b, int off, int length, int timeout) throws IOException {
if (this.eof) {
return -1;
} else if (this.impl.isConnectionReset()) {
throw new SocketException("Connection reset");
} else if (length > 0 && off >= 0 && length <= b.length - off) {
FileDescriptor fd = this.impl.acquireFD();
label99: {
int var7;
try {
int n = this.socketRead(fd, b, off, length, timeout);
if (n <= 0) {
break label99;
}
var7 = n;
} catch (ConnectionResetException var11) {
this.impl.setConnectionReset();
break label99;
} finally {
this.impl.releaseFD();
}
return var7;
}
if (this.impl.isClosedOrPending()) {
throw new SocketException("Socket closed");
} else if (this.impl.isConnectionReset()) {
throw new SocketException("Connection reset");
} else {
this.eof = true;
return -1;
}
} else if (length == 0) {
return 0;
} else {
throw new ArrayIndexOutOfBoundsException("length == " + length + " off == " + off + " buffer length == " + b.length);
}
}
private int socketRead(FileDescriptor fd, byte[] b, int off, int len, int timeout) throws IOException {
return this.socketRead0(fd, b, off, len, timeout);
}
private native int socketRead0(FileDescriptor var1, byte[] var2, int var3, int var4, int var5) throws IOException;