An alternative to adding the method to the MemorySegment is that you can use wrap(offset, limit) to wrap the memory segment and then do a bulk write to the byte buffer.