         var byteIndex:uint;
         var endOfLine:uint;
 
-        var lines:Array = [ ];
-        var lineBuffer:Array = new Array(3);
+        var outputBuffer:StringBuilder = new StringBuilder();
 
         var valueString:String;
-        var valueBuffer:Array;
-        var valueBufferLength:uint = (bytesPerLine * 3) - 1;
+        var valueBuffer:StringBuilder = new StringBuilder();
+        var valueBufferLength:uint = (bytesPerLine * 3);
 
         var charCodeBuffer:Array;
         var nonPrintingCharCode:uint;

                }
            }

            lineBuffer[1] = StringUtil.padRight(
                    valueBuffer.join(" "),
                    valueBufferLength, " ");

            lineBuffer[2] = StringUtil.padRight(
                    String.fromCharCode.apply(String, charCodeBuffer),
                    bytesPerLine, " ");

            lines.push(lineBuffer.join(" "));
        }

        return lines.join("\n");
    }
}
}


    public static function dumpDisplayTree(container:DisplayObjectContainer, maxDepth:int = 0):String
    {
        return getDisplayTreeDumper().dump(container, maxDepth);
    }

    private static var _displayTreeDumper:DisplayTreeDumper;

    private static function getDisplayTreeDumper():DisplayTreeDumper
    {
        if (!_displayTreeDumper)
        {
            _displayTreeDumper = new DisplayTreeDumper();
        }
        return _displayTreeDumper;
    }


    public static function dumpObject(root:*, maxDepth:int = 3):String
    {
        return getObjectDumper().dump(root, maxDepth);
    }

    private static var _objectDumper:ObjectDumper;

    private static function getObjectDumper():ObjectDumper
    {
        if (!_objectDumper)
        {
            _objectDumper = new ObjectDumper();
        }
        return _objectDumper;
    }


