If it appears to the Court or Judge, by affidavit or otherwise, or upon the inspection of the process or warrant of commitment, and such other papers in the proceedings as may be shown to the Court or Judge, that the party is guilty of a criminal offense, or ought not to be discharged, such Court or Judge, although the charge is defective or unsubstantially set forth in such process or warrant of commitment, must cause the complainant or other necessary witnesses to be subpoenaed to attend at such time as ordered, to testify before the Court or Judge; and upon the examination he may discharge such prisoner, let him to bail, if the offense be bailable, or recommit him to custody, as may be just and legal.
Ca. Pen. Code § 1489