getBuffer() public method

public getBuffer ( ) : global::java.lang.StringBuffer
return global::java.lang.StringBuffer
コード例 #1
0
 public static string getFilteredTrace(Exception t)
 {
   StringWriter stringWriter = new StringWriter();
   PrintWriter printWriter = new PrintWriter((Writer) stringWriter);
   Throwable.instancehelper_printStackTrace(t, printWriter);
   return BaseTestRunner.getFilteredTrace(stringWriter.getBuffer().toString());
 }
コード例 #2
0
ファイル: XNode.cs プロジェクト: exaphaser/JSC-Cross-Compiler
        public string InternalToString()
        {
            // http://faq.javaranch.com/java/DocumentToString
            var value = default(string);

            //Console.WriteLine("InternalToString " + new { this.InternalValue });
            try
            {


                //I/System.Console(12089): Caused by: java.lang.NullPointerException
                //I/System.Console(12089):        at org.apache.xml.serializer.ToStream.writeAttrString(ToStream.java:2099)
                //I/System.Console(12089):        at org.apache.xml.serializer.ToStream.processAttributes(ToStream.java:2079)
                //I/System.Console(12089):        at org.apache.xml.serializer.ToStream.closeStartTag(ToStream.java:2623)
                //I/System.Console(12089):        at org.apache.xml.serializer.ToStream.startElement(ToStream.java:1927)
                //I/System.Console(12089):        at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1073)
                //I/System.Console(12089):        at org.apache.xml.serializer.TreeWalker.startNode(TreeWalker.java:359)
                //I/System.Console(12089):        at org.apache.xml.serializer.TreeWalker.traverse(TreeWalker.java:145)
                //I/System.Console(12089):        at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:390)
                //I/System.Console(12089):        at ScriptCoreLibJava.BCLImplementation.System.Xml.Linq.__XNode.InternalToString(__XNode.java:81)


                this.InternalEnsureElement();

                // http://stackoverflow.com/questions/9150403/how-do-you-debug-an-xml-object-that-causes-a-transform-error-when-writing-to-str
                // http://dotcommers.wordpress.com/2008/10/22/javaxxmltransformtransformerexception-javalangnullpointerexception-how-to-solve/


                var s = new DOMSource(this.InternalValue);
                var w = new StringWriter();
                var r = new StreamResult(w);
                var f = TransformerFactory.newInstance();
                var transformer =  f.newTransformer();

                // http://stackoverflow.com/questions/15592025/transformer-setoutputpropertyoutputkeys-encoding-utf-8-is-not-working
                transformer.setOutputProperty(OutputKeys.METHOD, "xml");

                // meses up fields as cookie headers?
                //transformer.setOutputProperty(OutputKeys.INDENT, "yes");

                transformer.transform(s, r);

                value = w.getBuffer().toString();

                #region __XDocument
                var IsDocument = (this is __XDocument);
                if (!IsDocument)
                {
                    // hack.

                    {
                        var prefix = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

                        if (value.StartsWith(prefix))
                            value = value.Substring(prefix.Length);
                    }

                    {
                        var prefix = "\r\n";

                        if (value.StartsWith(prefix))
                            value = value.Substring(prefix.Length);
                    }
                }
                #endregion

            }
            catch (Exception err)
            {
                //  Message = java.lang.RuntimeException: Namespace for prefix 'xsi' has not been declared., StackTrace = jav
                // The input node can not be null for a DOMSource for newTemplates!


                // Z:\jsc.svn\examples\java\hybrid\JVMCLRWSDLMID\Program.cs

                //throw;

                value = err.Message;
            }

            return value;
        }
コード例 #3
0
ファイル: Failure.cs プロジェクト: NALSS/SmartDashboard.NET
 public virtual string getTrace()
 {
   StringWriter stringWriter = new StringWriter();
   Throwable.instancehelper_printStackTrace(this.getException(), new PrintWriter((Writer) stringWriter));
   return stringWriter.getBuffer().toString();
 }