public abstract int write (ByteBuffer src, long position) throws IOException

Writes a sequence of bytes to this channel from the given buffer, starting at the given file position.

This method works in the same manner as the write(ByteBuffer) method, except that bytes are written starting at the given file position rather than at the channel's current position. This method does not modify this channel's position. If the given position is greater than the file's current size then the file will be grown to accommodate the new bytes; the values of any bytes between the previous end-of-file and the newly-written bytes are unspecified.

Parameters:
src     The buffer from which bytes are to be transferred
position     The file position at which the transfer is to begin; must be non-negative

Returns:  The number of bytes written, possibly zero

Exceptions:
IllegalArgumentException     If the position is negative
NonWritableChannelException     If this channel was not opened for writing
ClosedChannelException     If this channel is closed
AsynchronousCloseException     If another thread closes this channel while the write operation is in progress
ClosedByInterruptException     If another thread interrupts the current thread while the write operation is in progress, thereby closing the channel and setting the current thread's interrupt status
IOException     If some other I/O error occurs