D.W. was a material witness to a robbery, and had failed to appear several times at trial, after having been subpoenaed to appear in court, and was ultimately incarcerated pursuant to Penal Code sections 1332 and 1209. This habeas proceeding was initiated seeking immediate release on the basis that D.W. was denied counsel and an unrestricted section 1332 hearing. The appellate court granted habeas relief. Section 1332 contemplates a hearing on all relevant issues, including whether there is an alternative to incarceration. The due process requirement of a meaningful opportunity to be heard could not be met without counsel. Further, the contempt order was invalid because it failed to recite sufficient details for the reviewing court to reach a conclusion about whether the conduct was contemptuous.