question: public boolean read ( final SocketChannel channel ) throws IOException { readCalls ++ ; if ( targetSize < 0 ) { if ( sizeBuffer == null ) { sizeBuffer = ByteBuffer . allocate ( 4 ) ; } final int size = channel . read ( sizeBuffer ) ; if ( logger . isLoggable ( Level . FINEST ) ) { logger . finest ( "read size_buffer bytes:" + size ) ; } if ( size == - 1 ) { throw new IOException ( "Socket closed" ) ; } if ( ! sizeBuffer . hasRemaining ( ) ) { sizeBuffer . flip ( ) ; targetSize = sizeBuffer . getInt ( ) ; if ( ( targetSize & 0xFF000000 ) != MAGIC ) { throw new IOException ( "Did not write magic!" ) ; } targetSize = targetSize & 0x00ffffff ; if ( targetSize <= 0 || targetSize > MAX_MESSAGE_SIZE ) { throw new IOException ( "Invalid triplea packet size:" + targetSize ) ; } contentBuffer = ByteBuffer . allocate ( targetSize ) ; sizeBuffer = null ; } else { return false ; } } final int size = channel . read ( contentBuffer ) ; if ( logger . isLoggable ( Level . FINEST ) ) { logger . finest ( "read content bytes:" + size ) ; } if ( size == - 1 ) { throw new IOException ( "Socket closed" ) ; } return ! contentBuffer . hasRemaining ( ) ; }
target:  Read data from the channel, returning true if this packet is done. <p> If we detect the socket is closed, we will throw an IOExcpetion