cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r454482 - /cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptObjectInlineXML.java
Date Mon, 09 Oct 2006 20:08:24 GMT
Author: joerg
Date: Mon Oct  9 13:08:23 2006
New Revision: 454482

URL: http://svn.apache.org/viewvc?view=rev&rev=454482
Log:
reusing the XScriptObjectInlineXML(XScriptManager, StringBuffer) constructor

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptObjectInlineXML.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptObjectInlineXML.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptObjectInlineXML.java?view=diff&rev=454482&r1=454481&r2=454482
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptObjectInlineXML.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/xsp/java/org/apache/cocoon/components/xscript/XScriptObjectInlineXML.java
Mon Oct  9 13:08:23 2006
@@ -38,51 +38,46 @@
     StringBufferContentHandler streamHandler;
 
     public XScriptObjectInlineXML(XScriptManager manager) {
-        super(manager);
-        stringBuffer = new StringBuffer();
-        stringBuffer.append("<?xml version=\"1.0\"?>\n\n");
-        streamHandler = new StringBufferContentHandler(stringBuffer);
+        this(manager, new StringBuffer("<?xml version=\"1.0\"?>\n\n"));
     }
 
-    public XScriptObjectInlineXML(XScriptManager manager, StringBuffer stringBuffer) {
-        super(manager);
-        this.stringBuffer = stringBuffer;
-        streamHandler = new StringBufferContentHandler(stringBuffer);
+    public XScriptObjectInlineXML(XScriptManager manager, String string) {
+        this(manager, new StringBuffer(string));
     }
 
-    public XScriptObjectInlineXML(XScriptManager manager, String string) {
+    public XScriptObjectInlineXML(XScriptManager manager, StringBuffer stringBuffer) {
         super(manager);
-        this.stringBuffer = new StringBuffer(string);
-        streamHandler = new StringBufferContentHandler(stringBuffer);
+        this.stringBuffer = stringBuffer;
+        this.streamHandler = new StringBufferContentHandler(this.stringBuffer);
     }
 
     public InputStream getInputStream() throws IOException {
         // FIXME(VG): This method should never be used because it
         // always converts content into system encoding. This will
         // ruin i18n documents. Use getInputSource() instead.
-        return new ByteArrayInputStream(stringBuffer.toString().getBytes());
+        return new ByteArrayInputStream(this.stringBuffer.toString().getBytes());
     }
 
     public InputSource getInputSource() throws IOException {
-        InputSource is = new InputSource(new StringReader(stringBuffer.toString()));
+        InputSource is = new InputSource(new StringReader(this.stringBuffer.toString()));
         is.setSystemId(getURI());
         return is;
     }
 
     public ContentHandler getContentHandler() {
-        return streamHandler;
+        return this.streamHandler;
     }
 
     public String toString() {
-        return stringBuffer.toString();
+        return this.stringBuffer.toString();
     }
 
     public long getContentLength() {
-        return stringBuffer.length();
+        return this.stringBuffer.length();
     }
 
     public String getContent() {
-        return stringBuffer.toString();
+        return this.stringBuffer.toString();
     }
 
     public String getURI() {
@@ -90,4 +85,5 @@
         // variables by URI
         return "xscript:inline:" + System.identityHashCode(this);
     }
+
 }



Mime
View raw message