Clover coverage report - brownies library - 1.0-beta-1
Coverage timestamp: 月 8 16 2004 17:14:42 GMT+09:00
file stats: LOC: 88   Methods: 9
NCLOC: 49   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
ZipEntryFileStreamFactory.java 0% 0% 0% 0%
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   
 import java.util.zip.ZipEntry;
 12   
 import java.util.zip.ZipFile;
 13   
 
 14   
 import org.asyrinx.brownie.core.io.FileNameUtils;
 15   
 
 16   
 /**
 17   
  * @author Akima
 18   
  */
 19   
 public class ZipEntryFileStreamFactory extends DirectoryBaseFileStreamFactory {
 20   
 
 21   
     /**
 22   
      * Constructor for ZipEntryFileStreamFactory.
 23   
      */
 24  0
     public ZipEntryFileStreamFactory(String zipFilePath) {
 25  0
         this(zipFilePath, "");
 26   
     }
 27   
 
 28   
     /**
 29   
      * Constructor for ZipEntryFileStreamFactory.
 30   
      */
 31  0
     public ZipEntryFileStreamFactory(File zipFile) {
 32  0
         this(zipFile, "");
 33   
     }
 34   
 
 35   
     /**
 36   
      * Constructor for ZipEntryFileStreamFactory.
 37   
      */
 38  0
     public ZipEntryFileStreamFactory(String zipFilePath, String baseDirectory) {
 39  0
         this(new File(zipFilePath), baseDirectory);
 40   
     }
 41   
 
 42   
     /**
 43   
      * Constructor for ZipEntryFileStreamFactory.
 44   
      */
 45  0
     public ZipEntryFileStreamFactory(File zipFile, String baseDirectory) {
 46  0
         super(baseDirectory);
 47  0
         this.zipFile = zipFile;
 48   
     }
 49   
 
 50   
     private final File zipFile;
 51   
 
 52   
     private ZipFile targetZip = null;
 53   
 
 54  0
     protected void initZipFile() throws IOException {
 55  0
         if (targetZip != null) {
 56  0
             return;
 57   
         }
 58  0
         targetZip = new ZipFile(this.zipFile);
 59   
     }
 60   
 
 61  0
     public String toZipEntryName(String fileName) {
 62  0
         return fileName;
 63   
     }
 64   
 
 65  0
     public String toFilePath(String virtualFileName) {
 66  0
         return FileNameUtils
 67   
                 .addSeparatorHead(super.toFilePath(virtualFileName));
 68   
     }
 69   
 
 70   
     /**
 71   
      */
 72  0
     public InputStream newInput(String fileName) throws IOException {
 73  0
         initZipFile();
 74  0
         String path = toFilePath(fileName);
 75  0
         ZipEntry entry = new ZipEntry(path);
 76  0
         InputStream result = targetZip.getInputStream(entry);
 77  0
         if (result == null)
 78  0
             throw new IOException("ストリーム[" + fileName + "]の取得に失敗しました。");
 79  0
         return result;
 80   
     }
 81   
 
 82   
     /**
 83   
      */
 84  0
     public OutputStream newOutput(String fileName) throws IOException {
 85  0
         return null;
 86   
     }
 87   
 
 88   
 }