Add read amd write method to a struct. to operate binary steam