1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.rendering.internal.renderer.printer

File WikiWriter.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart9.png
38% of files have more coverage

Code metrics

0
5
7
1
89
37
7
1.4
0.71
7
1

Classes

Class Line # Actions
WikiWriter 32 5 0% 7 2
0.833333383.3%
 

Contributing tests

This file is covered by 824 tests. .

Source view

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: 9c86b7f1884aa94d1068c89004a77df2b4b2eceb $
31    */
 
32    public class WikiWriter extends Writer
33    {
34    /**
35    * @param printer the actual printer
36    */
 
37  20130 toggle public WikiWriter(WikiPrinter printer)
38    {
39  20130 super(printer);
40    }
41   
42    /**
43    * @param printer the actual printer
44    */
 
45  19597 toggle public void setWikiPrinter(WikiPrinter printer)
46    {
47  19599 this.lock = printer;
48    }
49   
50    /**
51    * @return the actual printer
52    */
 
53  338513 toggle public WikiPrinter getWikiPrinter()
54    {
55  338517 return (WikiPrinter) this.lock;
56    }
57   
 
58  0 toggle @Override
59    public void close() throws IOException
60    {
61    // WikiPrinter does not support stream close
62    }
63   
 
64  0 toggle @Override
65    public void flush() throws IOException
66    {
67    // WikiPrinter does not support stream flush
68    }
69   
 
70  30134 toggle @Override
71    public void write(char[] cbuf, int off, int len) throws IOException
72    {
73  30134 getWikiPrinter().print(String.valueOf(cbuf, off, len));
74    }
75   
76    /**
77    * {@inheritDoc}
78    * <p>
79    * Override it to improve speed a little. Otherwise the String is transformed in char table passed to the over
80    * methods which recreate a String.
81    * </p>
82    */
 
83  307869 toggle @Override
84    public void write(String str) throws IOException
85    {
86  307869 getWikiPrinter().print(str);
87    }
88   
89    }