Uniform confidence bands: Characterization and optimality