buffer: consolidate writeString