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

File DoxiaPrinterAdapter.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart3.png
80% of files have more coverage

Code metrics

0
11
11
1
110
62
11
1
1
11
1

Classes

Class Line # Actions
DoxiaPrinterAdapter 34 11 0% 11 17
0.2272727322.7%
 

Contributing tests

This file is covered by 13 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.doxia;
21   
22    import java.io.IOException;
23    import java.io.Writer;
24   
25    import org.xwiki.rendering.renderer.printer.WikiPrinter;
26   
27    /**
28    * Bridge between {@link Writer} and {@link WikiPrinter}. This is needed since Doxia Sinks need to be passed a
29    * {@link Writer}.
30    *
31    * @version $Id: b338c8a58e499848660a7b3a5f9a974414b9e33f $
32    * @since 3.2RC1
33    */
 
34    public class DoxiaPrinterAdapter extends Writer
35    {
36    /**
37    * The wiki printer to print to.
38    */
39    private WikiPrinter printer;
40   
41    /**
42    * @param printer the wiki printer to print to
43    */
 
44  21 toggle public DoxiaPrinterAdapter(WikiPrinter printer)
45    {
46  21 this.printer = printer;
47    }
48   
 
49  0 toggle @Override
50    public Writer append(char c) throws IOException
51    {
52  0 this.printer.print("" + c);
53  0 return this;
54    }
55   
 
56  0 toggle @Override
57    public Writer append(CharSequence charSequence, int i, int i1) throws IOException
58    {
59  0 return append(charSequence.subSequence(i, i1));
60    }
61   
 
62  0 toggle @Override
63    public Writer append(CharSequence charSequence) throws IOException
64    {
65  0 this.printer.print(charSequence.toString());
66  0 return this;
67    }
68   
 
69  0 toggle @Override
70    public void close() throws IOException
71    {
72    // Do nothing
73    }
74   
 
75  19 toggle @Override
76    public void flush() throws IOException
77    {
78    // Do nothing
79    }
80   
 
81  0 toggle @Override
82    public void write(char[] chars) throws IOException
83    {
84  0 this.printer.print(new String(chars));
85    }
86   
 
87  0 toggle @Override
88    public void write(char[] chars, int i, int i1) throws IOException
89    {
90  0 this.printer.print(new String(chars, i, i1));
91    }
92   
 
93  0 toggle @Override
94    public void write(int i) throws IOException
95    {
96  0 this.printer.print("" + i);
97    }
98   
 
99  0 toggle @Override
100    public void write(String s) throws IOException
101    {
102  0 this.printer.print(s);
103    }
104   
 
105  543 toggle @Override
106    public void write(String s, int i, int i1) throws IOException
107    {
108  543 this.printer.print(s.substring(i, i1));
109    }
110    }