Gas Flows In And Out Of Galaxies: Solving The Cosmic Baryon Cycle