| 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; |
| 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 |
|
|
| 51 |
|
|
| 52 |
|
|
| 53 |
|
|
| 54 |
|
|
| 55 |
|
public FeedFormat getFormat() { |
| 56 |
12 |
return _format; |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| 63 |
|
|
| 64 |
|
|
| 65 |
|
public void setFormat(FeedFormat format) { |
| 66 |
300 |
if(format != null){ |
| 67 |
300 |
_format = format; |
| 68 |
|
} |
| 69 |
300 |
} |
| 70 |
|
|
| 71 |
|
} |