Clover coverage report - brownies library - 1.0-beta-1
Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00
file stats: LOC: 97   Methods: 10
NCLOC: 61   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
AbstractFileStreamFactory.java 12.5% 19.2% 30% 19.2%
coverage coverage
 1   
 /*
 2   
  * Joey and its relative products are published under the terms
 3   
  * of the Apache Software License.
 4   
  */
 5   
 package org.asyrinx.brownie.core.io.sf;
 6   
 
 7   
 import java.io.File;
 8   
 import java.io.IOException;
 9   
 import java.io.InputStream;
 10   
 import java.io.OutputStream;
 11   
 
 12   
 /**
 13   
  * @author Akima
 14   
  */
 15   
 public abstract class AbstractFileStreamFactory implements FileStreamFactory {
 16   
 
 17   
     /**
 18   
      * Constructor for AbstractFileStreamFactory.
 19   
      */
 20  8
     public AbstractFileStreamFactory() {
 21  8
         super();
 22   
     }
 23   
 
 24  0
     protected IOException keyClassMismatch(Object key) {
 25  0
         return new IOException("key=[" + key
 26   
                 + "]はFileクラスまたはStringクラスのインスタンスでなくてはなりません。");
 27   
     }
 28   
 
 29  0
     protected RuntimeException keyClassMismatchRuntime(Object key) {
 30  0
         return new RuntimeException("key=[" + key
 31   
                 + "]はFileクラスまたはStringクラスのインスタンスでなくてはなりません。");
 32   
     }
 33   
 
 34  0
     public String toFilePath(Object key) {
 35  0
         if (key instanceof File)
 36  0
             return ((File) key).getAbsolutePath();
 37  0
         else if (key instanceof String)
 38  0
             return toFilePath((String) key);
 39   
         else
 40  0
             throw keyClassMismatchRuntime(key);
 41   
     }
 42   
 
 43  0
     public File toFile(Object key) {
 44  0
         if (key instanceof File)
 45  0
             return (File) key;
 46  0
         else if (key instanceof String)
 47  0
             return toFile((String) key);
 48   
         else
 49  0
             throw keyClassMismatchRuntime(key);
 50   
     }
 51   
 
 52   
     abstract public String toFilePath(String fileName);
 53   
 
 54  0
     public final File toFile(String fileName) {
 55  0
         return new File(toFilePath(fileName));
 56   
     }
 57   
 
 58   
     /**
 59   
      *  
 60   
      */
 61  3
     public InputStream newInput(Object key) throws IOException {
 62  3
         if (key instanceof File) {
 63  0
             return newInput((File) key);
 64  3
         } else if (key instanceof String) {
 65  3
             return newInput((String) key);
 66   
         } else {
 67  0
             throw keyClassMismatch(key);
 68   
         }
 69   
     }
 70   
 
 71   
     /**
 72   
      *  
 73   
      */
 74  1
     public InputStream newInput(File file) throws IOException {
 75  1
         return newInput(file.getPath());
 76   
     }
 77   
 
 78   
     /**
 79   
      *  
 80   
      */
 81  0
     public OutputStream newOutput(Object key) throws IOException {
 82  0
         if (key instanceof File) {
 83  0
             return newOutput((File) key);
 84  0
         } else if (key instanceof String) {
 85  0
             return newOutput((String) key);
 86   
         } else {
 87  0
             throw keyClassMismatch(key);
 88   
         }
 89   
     }
 90   
 
 91   
     /**
 92   
      *  
 93   
      */
 94  0
     public OutputStream newOutput(File file) throws IOException {
 95  0
         return newOutput(file.getPath());
 96   
     }
 97   
 }