code: public void writeClassAndObject (Output output, Object object) {
  		if (output == null) throw new IllegalArgumentException("output cannot be null.");
  		beginObject();
  		try {
  			if (object == null) {
  				writeClass(output, null);
  				return;
  			}
  			Registration registration = writeClass(output, object.getClass());
  			if (references && writeReferenceOrNull(output, object, false)) return;
  			if (TRACE || (DEBUG && depth == 1)) log("Write", object, output.position());
  			registration.getSerializer().write(this, output, object);
  		} finally {
  			if (--depth == 0 && autoReset) reset();
  		}
  	}
docs: Writes the class and object or null using the registered serializer.
  @param object May be null.