Clover Coverage Report - XWiki Rendering - Parent POM 4.0-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Mar 12 2012 18:03:13 CET
../../../../../../img/srcFileCovDistChart9.png 55% of files have more coverage
5   79   7   0.71
0   37   1.4   7
7     1  
1    
 
  WikiWriter       Line # 32 5 0% 7 2 83.3% 0.8333333
 
  (247)
 
1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.rendering.internal.renderer.printer;
21   
22    import java.io.IOException;
23    import java.io.Writer;
24   
25    import org.xwiki.rendering.renderer.printer.WikiPrinter;
26   
27    /**
28    * Bridge so that {@link WikiPrinter} can be used in a tools supporting {@link Writer} api.
29    *
30    * @version $Id: 0dcf36d23402fcb4e610d734e15b9efa777d48ff $
31    */
 
32    public class WikiWriter extends Writer
33    {
 
34  255 toggle public WikiWriter(WikiPrinter printer)
35    {
36  255 super(printer);
37    }
38   
 
39  247 toggle public void setWikiPrinter(WikiPrinter printer)
40    {
41  247 this.lock = printer;
42    }
43   
 
44  15279 toggle public WikiPrinter getWikiPrinter()
45    {
46  15279 return (WikiPrinter) this.lock;
47    }
48   
 
49  0 toggle @Override
50    public void close() throws IOException
51    {
52    // WikiPrinter does not support stream close
53    }
54   
 
55  0 toggle @Override
56    public void flush() throws IOException
57    {
58    // WikiPrinter does not support stream flush
59    }
60   
 
61  1546 toggle @Override
62    public void write(char[] cbuf, int off, int len) throws IOException
63    {
64  1546 getWikiPrinter().print(new String(cbuf, off, len));
65    }
66   
67    /**
68    * {@inheritDoc}
69    * <p>
70    * Override it to improve speed a little. Otherwise the String is transformed in char table passed to the over
71    * methods which recreate a String.
72    */
 
73  13733 toggle @Override
74    public void write(String str) throws IOException
75    {
76  13733 getWikiPrinter().print(str);
77    }
78   
79    }