The sheriff of any county shall receive and keep any prisoner committed by a justice of the peace according to the order of commitment.