private synchronized void bufferChange() throws ReadFailedException {
  ByteBuffer current=super.getByteBuffer();
  if (null != current) {
    current.clear();
    emptyBuffers.add(current);
  }
  int tries=0;
  while (true) {
    try {
      ByteBuffer buffer=fullBuffers.poll(100,TimeUnit.MILLISECONDS);
      if (null != buffer) {
        super.setByteBuffer(buffer);
        break;
      }
 else {
        tries++;
        if (readFailed || (tries > MAX_BUFFER_POOL_TRIES)) {
          throw new ReadFailedException("Time-out trying to get the full byte buffer to read from.");
        }
      }
    }
 catch (    InterruptedException e) {
      Thread.interrupted();
    }
  }
}

private synchronized void bufferChange ( ) throws ReadFailedException { ByteBuffer current = super . getByteBuffer ( ) ; if ( null != current ) { current . clear ( ) ; emptyBuffers . add ( current ) ; } int tries = 0 ; while ( true ) { try { ByteBuffer buffer = fullBuffers . poll ( 100 , TimeUnit . MILLISECONDS ) ; if ( null != buffer ) { super . setByteBuffer ( buffer ) ; break ; } else { tries ++ ; if ( readFailed || ( tries > MAX_BUFFER_POOL_TRIES ) ) { throw new ReadFailedException ( "Time-out trying to get the full byte buffer to read from." ) ; } } } catch ( InterruptedException e ) { Thread . interrupted ( ) ; } } }
changes the current buffer used for streaming with a full one .
