private boolean syncRead ( int amountToRead ) throws IOException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "syncRead, Executing a synchronous read" ) ; } // Allocate the buffer and set it on the TCP Channel setAndAllocateBuffer ( amountToRead ) ; try { long bytesRead = _tcpContext . getReadInterface ( ) . read ( 1 , WCCustomProperties31 . UPGRADE_READ_TIMEOUT ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "syncRead, Completed the read, " + bytesRead ) ; } if ( bytesRead > 0 ) { //Get the buffer from the TCP Channel after we have told them to read. _buffer = _tcpContext . getReadInterface ( ) . getBuffer ( ) ; //We don't need to check for null first as we know we will always get the buffer we just set configurePostReadBuffer ( ) ; // record the new amount of data read from the channel _totalBytesRead += _buffer . remaining ( ) ; return true ; } return false ; } catch ( IOException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "syncRead, We encountered an exception during the read : " + e ) ; } _error = e ; throw e ; } }
Issues a synchronous read to the TCP Channel .