truncate
Truncates the data source underlying this channel to a given size. Any bytes beyond the given size are removed. If there are no bytes beyond the given size then the contents are unmodified.
If the position is currently greater than the given size, then it is set to the new size.
Return
this channel.
Throws
if the requested size is negative.
if this channel is closed.
if the channel cannot be written to.
if another I/O error occurs.