public void writeDottedList(CycList dottedList)
                       throws IOException {
    int size = dottedList.getProperListSize();

    if (trace == API_TRACE_DETAILED) {
      Log.current.println("writeDottedList = " + dottedList.toString() + 
                          "\n  proper elements size " + size);
    }
    
    write(CFASL_DOTTED);
    writeInt(size);

    for (int i = 0; i < size; i++) {
      writeObject(dottedList.get(i));
    }

    Object dottedElement = dottedList.getDottedElement();

    if (trace == API_TRACE_DETAILED) {
      try {
        // If object dottedElement understands the safeToString method, then use it.
        Method safeToString = dottedElement.getClass().getMethod("safeToString");
        Log.current.println("writeDottedList.cdr = " + 
                            safeToString.invoke(dottedElement));
      }
       catch (Exception e) {
        Log.current.println("writeDottedList.cdr = " + dottedElement);
      }
    }

    writeObject(dottedElement);
  }