handle read-only MemoryStream.write()