int apply(FileChannel channel) throws IOException {
  if (isTruncate()) {
    channel.truncate(position);
    return -1;
  }
  int len=channel.write(buffer,position);
  buffer.flip();
  return len;
}

int apply ( FileChannel channel ) throws IOException { if ( isTruncate ( ) ) { channel . truncate ( position ) ; return - 1 ; } int len = channel . write ( buffer , position ) ; buffer . flip ( ) ; return len ; }
apply the operation to the channel .
