After an indictment shall be found against any defendant, he may have witnesses examined in his behalf conditionally on the order of a judge of the court in which the indictment is pending, in the same cases upon the like notice to the prosecuting attorney, and with like effect in all respects as in civil suits.