write method of wrtiable stream