public int write(final ByteBuffer byteBuffer) throws IOException {
  ensureOpen();
  final int remaining=byteBuffer.remaining();
  if (inspectable < buffer.length) {
    final int toBuffer=Math.min(buffer.length - inspectable,remaining);
    byteBuffer.get(buffer,inspectable,toBuffer);
    inspectable+=toBuffer;
  }
  if (byteBuffer.hasRemaining()) {
    fileChannel.position(writePosition);
    writePosition+=fileChannel.write(byteBuffer);
  }
  return remaining;
}

public int write ( final ByteBuffer byteBuffer ) throws IOException { ensureOpen ( ) ; final int remaining = byteBuffer . remaining ( ) ; if ( inspectable < buffer . length ) { final int toBuffer = Math . min ( buffer . length - inspectable , remaining ) ; byteBuffer . get ( buffer , inspectable , toBuffer ) ; inspectable += toBuffer ; } if ( byteBuffer . hasRemaining ( ) ) { fileChannel . position ( writePosition ) ; writePosition += fileChannel . write ( byteBuffer ) ; } return remaining ; }
appends the content of a specified buffer to the end of the currently represented stream .
