unified writing raw data to the binary