Clover coverage report - Code Coverage for tapestry release 3.1-alpha-1
Coverage timestamp: Mon Feb 21 2005 09:16:14 EST
file stats: LOC: 67   Methods: 2
NCLOC: 23   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
NestedWMLWriter.java - 100% 100% 100%
coverage
 1   
 // Copyright 2004, 2005 The Apache Software Foundation
 2   
 //
 3   
 // Licensed under the Apache License, Version 2.0 (the "License");
 4   
 // you may not use this file except in compliance with the License.
 5   
 // You may obtain a copy of the License at
 6   
 //
 7   
 //     http://www.apache.org/licenses/LICENSE-2.0
 8   
 //
 9   
 // Unless required by applicable law or agreed to in writing, software
 10   
 // distributed under the License is distributed on an "AS IS" BASIS,
 11   
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12   
 // See the License for the specific language governing permissions and
 13   
 // limitations under the License.
 14   
 
 15   
 package org.apache.tapestry.wml;
 16   
 
 17   
 import java.io.CharArrayWriter;
 18   
 import java.io.PrintWriter;
 19   
 
 20   
 import org.apache.tapestry.IMarkupWriter;
 21   
 
 22   
 /**
 23   
  *  Subclass of {@link org.apache.tapestry.wml.WMLWriter} that is nested.  A nested writer
 24   
  *  buffers its output, then inserts it into its parent writer when it is
 25   
  *  closed.
 26   
  *
 27   
  *  @author David Solis
 28   
  *  @since 0.2.9
 29   
  * 
 30   
  **/
 31   
 
 32   
 public class NestedWMLWriter extends WMLWriter
 33   
 {
 34   
     private IMarkupWriter _parent;
 35   
     private CharArrayWriter _internalBuffer;
 36   
 
 37  29
     public NestedWMLWriter(IMarkupWriter parent)
 38   
     {
 39  29
         super(parent.getContentType());
 40   
 
 41  29
         _parent = parent;
 42   
 
 43  29
         _internalBuffer = new CharArrayWriter();
 44   
 
 45  29
        setWriter(new PrintWriter(_internalBuffer));
 46   
     }
 47   
 
 48   
     /**
 49   
      *  Invokes the {@link WMLWriter#close() super-class
 50   
      *  implementation}, then gets the data accumulated in the
 51   
      *  internal buffer and provides it to the containing writer using
 52   
      *  {@link IMarkupWriter#printRaw(char[], int, int)}.
 53   
      *
 54   
      **/
 55   
 
 56  25
     public void close()
 57   
     {
 58  25
         super.close();
 59   
 
 60  25
         char[] data = _internalBuffer.toCharArray();
 61   
 
 62  25
         _parent.printRaw(data, 0, data.length);
 63   
 
 64  25
         _internalBuffer = null;
 65  25
         _parent = null;
 66   
     }
 67   
 }