Add API for writing bytes to Memory