Coverage Report - org.codehaus.plexus.archiver.bzip2.PlexusIoBzip2ResourceCollection
 
Classes in this File Line Coverage Branch Coverage Complexity
PlexusIoBzip2ResourceCollection
100%
8/8
N/A
1,333
 
 1  
 package org.codehaus.plexus.archiver.bzip2;
 2  
 
 3  
 import java.io.File;
 4  
 import java.io.FileInputStream;
 5  
 import java.io.IOException;
 6  
 import java.io.InputStream;
 7  
 import java.util.HashMap;
 8  
 import javax.annotation.Nonnull;
 9  
 import javax.annotation.WillNotClose;
 10  
 import org.codehaus.plexus.components.io.attributes.FileAttributes;
 11  
 import org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributes;
 12  
 import org.codehaus.plexus.components.io.resources.PlexusIoCompressedFileResourceCollection;
 13  
 import org.codehaus.plexus.components.io.resources.PlexusIoResourceCollection;
 14  
 import org.codehaus.plexus.util.IOUtil;
 15  
 
 16  
 /**
 17  
  * Implementation of {@link PlexusIoResourceCollection} for
 18  
  * bzip2 compressed files.
 19  
  */
 20  1
 public class PlexusIoBzip2ResourceCollection
 21  
     extends PlexusIoCompressedFileResourceCollection
 22  
 {
 23  
 
 24  
     @Nonnull
 25  
     @Override
 26  
     protected @WillNotClose
 27  
     InputStream getInputStream( File file )
 28  
         throws IOException
 29  
     {
 30  1
         InputStream fis = new FileInputStream( file );
 31  
         try
 32  
         {
 33  1
             final InputStream result = BZip2UnArchiver.getBZip2InputStream( fis );
 34  1
             fis = null;
 35  1
             return result;
 36  
         }
 37  
         finally
 38  
         {
 39  1
             IOUtil.close( fis );
 40  
         }
 41  
     }
 42  
 
 43  
     @Override protected PlexusIoResourceAttributes getAttributes( File file ) throws IOException
 44  
     {
 45  1
         return new FileAttributes( file, new HashMap<Integer, String>(), new HashMap<Integer, String>() );
 46  
     }
 47  
 
 48  
     @Override
 49  
     protected String getDefaultExtension()
 50  
     {
 51  1
         return ".bz2";
 52  
     }
 53  
 
 54  
 }