@Override public final int read() throws IOException {
  ByteBuffer bb=waitForAvailableData();
  return (bb.get() & 0xff);
}

@ Override public final int read ( ) throws IOException { ByteBuffer bb = waitForAvailableData ( ) ; return ( bb . get ( ) & 0xff ) ; }
see the inputstream read method for javadocs . note that if an attempt to read past the end of the wrapped bytebuffer is done this method throws bufferunderflowexception
