protected void writeObject(Object object) throws IOException {
        if (log.isDebugEnabled())
        {
            if (object == null)
            {
                log.debug("Writing object, object param == null");
            }
            else
            {
                log.debug("Writing object, class = " + object.getClass());
            }
        }
        //String customClassName = null;
        /*
            OpenAMFConfig.getInstance().getCustomClassName(
                object.getClass().getName());
        */
        //if (customClassName == null) {
            outputStream.writeByte(AMF0Body.DATA_TYPE_OBJECT);
        /*} else {
            if (log.isDebugEnabled()) {
                log.debug("customClassName : " + customClassName);
            }
            outputStream.writeByte(AMF0Body.DATA_TYPE_CUSTOM_CLASS);
            outputStream.writeUTF(customClassName);
        }*/
        try {
            PropertyDescriptor[] properties =
                PropertyUtils.getPropertyDescriptors(object);
            for (int i = 0; i < properties.length; i++) {
                if (!properties[i].getName().equals("class")) {
                    String propertyName = properties[i].getName();
                    Method readMethod = properties[i].getReadMethod();
                    Object propertyValue = null;
                    if (readMethod == null) {
                        log.error(
                            "unable to find readMethod for : "
                                + propertyName
                                + " writing null!");
                    } else {
                        log.debug("invoking readMethod " + readMethod);
                        propertyValue =
                            readMethod.invoke(object, new Object[0]);
                    }
                    log.debug(propertyName + " = " + propertyValue);
                    outputStream.writeUTF(propertyName);
                    writeData(propertyValue);
                }
            }
            outputStream.writeShort(0);
            outputStream.writeByte(AMF0Body.DATA_TYPE_OBJECT_END);
        } catch (RuntimeException e) {
            throw e;
        } catch (Exception e) {
            log.error(e, e);
            throw new IOException(e.getMessage());
        }
    }