// / Call this after initialization to get things going.
 public synchronized void encode() throws IOException {
   encoding = true;
   iox = null;
   producer.startProduction(this);
   while (encoding)
     try {
       wait();
     } catch (InterruptedException e) {
     }
   if (iox != null) throw iox;
 }
 public void imageComplete(int status) {
   producer.removeConsumer(this);
   if (status == ImageConsumer.IMAGEABORTED) iox = new IOException("image aborted");
   else {
     try {
       encodeFinish();
       encodeDone();
     } catch (IOException e) {
       iox = e;
     }
   }
   stop();
 }