public int dataAvailable ( ) { if ( readBuffer . position ( ) < fillBuffer . position ( ) ) { return readBuffer . remaining ( ) ; } else if ( readBuffer . position ( ) > fillBuffer . position ( ) ) { return capacity - fillBuffer . remaining ( ) ; } else { if ( readBuffer . hasRemaining ( ) ) { return readBuffer . remaining ( ) + fillBuffer . position ( ) ; } else { return 0 ; } } }
Gets the number of bytes that can be read .