You can truncate a channel to a given size using channel.truncate(size),
but it is doubtful that this would work portably in combination with
channel.map(). A lot of channel.map is dependent on the underlying
operating system. It is generally not a good idea to mix "file access" and
"memory mapped access" on the same file. Other solution could be to have a
"size-used" value at the beginning of each chunk.