Serializes a PLY file to a stream