1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.filter.output

File AbstractWriterOutputTarget.java

 

Coverage histogram

../../../../img/srcFileCovDistChart5.png
74% of files have more coverage

Code metrics

6
8
4
1
65
34
7
0.88
2
4
1.75

Classes

Class Line # Actions
AbstractWriterOutputTarget 29 8 0% 7 9
0.550%
 

Contributing tests

This file is covered by 36 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.filter.output;
21   
22    import java.io.IOException;
23    import java.io.Writer;
24   
25    /**
26    * @version $Id: eb5ff7bff266f789b807626936d71094a405e7fc $
27    * @since 6.2M1
28    */
 
29    public abstract class AbstractWriterOutputTarget implements WriterOutputTarget
30    {
31    protected Writer writer;
32   
33    protected abstract Writer openWriter();
34   
 
35  0 toggle @Override
36    public boolean restartSupported()
37    {
38  0 return true;
39    }
40   
 
41  1299 toggle @Override
42    public Writer getWriter()
43    {
44  1299 if (this.writer == null) {
45  1296 this.writer = openWriter();
46    }
47   
48  1299 return this.writer;
49    }
50   
 
51  0 toggle @Override
52    public void close() throws IOException
53    {
54  0 if (this.writer != null) {
55  0 this.writer.close();
56    }
57  0 this.writer = null;
58    }
59   
 
60  1293 toggle @Override
61    public String toString()
62    {
63  1293 return this.writer != null ? this.writer.toString() : "";
64    }
65    }