Coverage Report - yarfraw.io.AbstractBaseIO
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractBaseIO
60% 
100% 
1.273
 
 1  
 package yarfraw.io;
 2  
 
 3  
 import java.io.File;
 4  
 import java.net.URI;
 5  
 
 6  
 import yarfraw.core.datamodel.FeedFormat;
 7  
 
 8  
 abstract class AbstractBaseIO{
 9  
   protected File _file;
 10  381
   protected FeedFormat _format = FeedFormat.RSS20; //default
 11  330
   public AbstractBaseIO(){}
 12  
   
 13  216
   public AbstractBaseIO(File file, FeedFormat format){
 14  216
     if(file == null){
 15  0
       throw new IllegalArgumentException("File cannot be null");
 16  
     }
 17  216
     _file = file;
 18  216
     setFormat(format);
 19  216
   }
 20  
   
 21  
   public AbstractBaseIO(String pathName, FeedFormat format){
 22  0
     this(new File(pathName), format);
 23  0
   }
 24  
   
 25  
   public AbstractBaseIO(URI uri, FeedFormat format){
 26  0
     this(new File(uri), format);
 27  0
   }
 28  
   
 29  
   public AbstractBaseIO(File file){
 30  192
     this(file, FeedFormat.RSS20);
 31  192
   }
 32  
   
 33  
   public AbstractBaseIO(String pathName){
 34  0
     this(new File(pathName), FeedFormat.RSS20);
 35  0
   }
 36  
   
 37  
   public AbstractBaseIO(URI uri){
 38  0
     this(new File(uri), FeedFormat.RSS20);
 39  0
   }
 40  
   
 41  
   
 42  
   public File getFile() {
 43  0
     return _file;
 44  
   }
 45  
   public void setFile(File file) {
 46  15
     _file = file;
 47  15
   }
 48  
   
 49  
   /**
 50  
    * The {@link FeedFormat} this writer should be using.<br/>
 51  
    * if this is not set, the default is RSS 2.0 format. <code>null</code> format is ignored  
 52  
    * <p/>
 53  
    * rss 2.0 is recommended, use other format if you really need to
 54  
    */
 55  
   public FeedFormat getFormat() {
 56  12
     return _format;
 57  
   }
 58  
   /**
 59  
    * The {@link FeedFormat} this writer should be using.<br/>
 60  
    * if this is not set, the default is RSS 2.0 format. <code>null</code> format is ignored
 61  
    * <p/>
 62  
    * rss 2.0 is recommended, use other format if you really need to
 63  
    *  
 64  
    */
 65  
   public void setFormat(FeedFormat format) {
 66  300
     if(format != null){
 67  300
       _format = format;
 68  
     } 
 69  300
   }
 70  
   
 71  
 }