public int readInt ( ) { if ( available ( ) < 4 ) { throw new RuntimeException ( "not enough data available, check available() > 4 before calling" ) ; } int ch1 = poll ( ) ; int ch2 = poll ( ) ; int ch3 = poll ( ) ; int ch4 = poll ( ) ; return ( ch4 << 24 ) + ( ch3 << 16 ) + ( ch2 << 8 ) + ( ch1 << 0 ) ; }
read an int . throws an exception if not enough data is present