void updateBuffers(int bytesWritten){
  for (int i=0; i < numBufs; i++) {
    ByteBuffer nextBuffer=bufs[i];
    int pos=nextBuffer.position();
    int lim=nextBuffer.limit();
    int len=(pos <= lim ? lim - pos : lim);
    if (bytesWritten >= len) {
      bytesWritten-=len;
      int newPosition=pos + len;
      try {
        nextBuffer.position(newPosition);
      }
 catch (      IllegalArgumentException x) {
      }
    }
 else {
      if (bytesWritten > 0) {
        assert (pos + bytesWritten < (long)Integer.MAX_VALUE);
        int newPosition=pos + bytesWritten;
        try {
          nextBuffer.position(newPosition);
        }
 catch (        IllegalArgumentException x) {
        }
      }
      break;
    }
  }
}

void updateBuffers ( int bytesWritten ) { for ( int i = 0 ; i < numBufs ; i ++ ) { ByteBuffer nextBuffer = bufs [ i ] ; int pos = nextBuffer . position ( ) ; int lim = nextBuffer . limit ( ) ; int len = ( pos <= lim ? lim - pos : lim ) ; if ( bytesWritten >= len ) { bytesWritten -= len ; int newPosition = pos + len ; try { nextBuffer . position ( newPosition ) ; } catch ( IllegalArgumentException x ) { } } else { if ( bytesWritten > 0 ) { assert ( pos + bytesWritten < ( long ) Integer . MAX_VALUE ) ; int newPosition = pos + bytesWritten ; try { nextBuffer . position ( newPosition ) ; } catch ( IllegalArgumentException x ) { } } break ; } } }
invoked after a write has completed to update the buffer positions and release any substituted buffers .
