write callbacks and Stdio.File.set_buffer_mode()