1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.extension.repository.internal.local

File DefaultLocalExtensionFile.java

 

Coverage histogram

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

Code metrics

0
6
6
1
85
38
6
1
1
6
1

Classes

Class Line # Actions
DefaultLocalExtensionFile 35 6 0% 6 2
0.833333383.3%
 

Contributing tests

This file is covered by 115 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.extension.repository.internal.local;
21   
22    import java.io.File;
23    import java.io.FileInputStream;
24    import java.io.IOException;
25    import java.io.InputStream;
26   
27    import org.xwiki.extension.LocalExtensionFile;
28   
29    /**
30    * Default implementation of {@link LocalExtensionFile}.
31    *
32    * @version $Id: 53796db37c914fabea43bbb29809290fe45bf1f8 $
33    * @since 4.0M1
34    */
 
35    public class DefaultLocalExtensionFile implements LocalExtensionFile
36    {
37    /**
38    * The filesystem file of the local extension.
39    */
40    private File file;
41   
42    /**
43    * @param file the filesystem file of the local extension
44    */
 
45  1693 toggle public DefaultLocalExtensionFile(File file)
46    {
47  1693 this.file = file;
48    }
49   
50    /**
51    * @return the real file
52    */
 
53  2285 toggle public File getFile()
54    {
55  2285 return this.file;
56    }
57   
58    // ExtensionFile
59   
 
60  0 toggle @Override
61    public long getLength()
62    {
63  0 return getFile().length();
64    }
65   
 
66  347 toggle @Override
67    public InputStream openStream() throws IOException
68    {
69  347 return new FileInputStream(getFile());
70    }
71   
72    // LocalExtensionFile
73   
 
74  424 toggle @Override
75    public String getAbsolutePath()
76    {
77  424 return getFile().getAbsolutePath();
78    }
79   
 
80  9 toggle @Override
81    public String getName()
82    {
83  9 return getFile().getName();
84    }
85    }