src/share/classes/java/net/SocketInputStream.java
Print this page
rev 10457 : 8054720: Modifications of I/O methods for instrumentation purposes
Summary: Wrap some native methods in Java methods and change native method names to a consistent form.
Reviewed-by: TBD
*** 91,102 ****
* returned when the end of the stream is reached.
* @exception IOException If an I/O error has occurred.
*/
private native int socketRead0(FileDescriptor fd,
byte b[], int off, int len,
! int timeout)
! throws IOException;
/**
* Reads into a byte array data from the socket.
* @param b the buffer into which the data is read
* @return the actual number of bytes read, -1 is
--- 91,119 ----
* returned when the end of the stream is reached.
* @exception IOException If an I/O error has occurred.
*/
private native int socketRead0(FileDescriptor fd,
byte b[], int off, int len,
! int timeout) throws IOException;
!
! /**
! * Reads into an array of bytes at the specified offset using
! * the received socket primitive.
! * @param fd the FileDescriptor
! * @param b the buffer into which the data is read
! * @param off the start offset of the data
! * @param len the maximum number of bytes read
! * @param timeout the read timeout in ms
! * @return the actual number of bytes read, -1 is
! * returned when the end of the stream is reached.
! * @exception IOException If an I/O error has occurred.
! */
! private int socketRead(FileDescriptor fd,
! byte b[], int off, int len,
! int timeout) throws IOException {
! return socketRead0(fd, b, off, len, timeout);
! }
/**
* Reads into a byte array data from the socket.
* @param b the buffer into which the data is read
* @return the actual number of bytes read, -1 is
*** 145,155 ****
boolean gotReset = false;
// acquire file descriptor and do the read
FileDescriptor fd = impl.acquireFD();
try {
! n = socketRead0(fd, b, off, length, timeout);
if (n > 0) {
return n;
}
} catch (ConnectionResetException rstExc) {
gotReset = true;
--- 162,172 ----
boolean gotReset = false;
// acquire file descriptor and do the read
FileDescriptor fd = impl.acquireFD();
try {
! n = socketRead(fd, b, off, length, timeout);
if (n > 0) {
return n;
}
} catch (ConnectionResetException rstExc) {
gotReset = true;
*** 163,173 ****
*/
if (gotReset) {
impl.setConnectionResetPending();
impl.acquireFD();
try {
! n = socketRead0(fd, b, off, length, timeout);
if (n > 0) {
return n;
}
} catch (ConnectionResetException rstExc) {
} finally {
--- 180,190 ----
*/
if (gotReset) {
impl.setConnectionResetPending();
impl.acquireFD();
try {
! n = socketRead(fd, b, off, length, timeout);
if (n > 0) {
return n;
}
} catch (ConnectionResetException rstExc) {
} finally {