|
1 |
| package com.agical.rdoc.core.target.impl; |
|
2 |
| |
|
3 |
| import java.io.File; |
|
4 |
| import java.io.FileNotFoundException; |
|
5 |
| import java.io.FileOutputStream; |
|
6 |
| import java.io.OutputStream; |
|
7 |
| |
|
8 |
| import com.agical.rdoc.core.exception.RDocOutputException; |
|
9 |
| import com.agical.rdoc.core.target.TargetProvider; |
|
10 |
| |
|
11 |
| public abstract class AbstractTargetProvider implements TargetProvider { |
|
12 |
2
| public OutputStream createRelativeOutputStream(String name){
|
|
13 |
2
| File target = getTarget();
|
|
14 |
2
| File file = new File(target, name);
|
|
15 |
2
| file.getParentFile().mkdirs();
|
|
16 |
2
| try {
|
|
17 |
2
| return new FileOutputStream(file.getAbsolutePath());
|
|
18 |
| } catch (FileNotFoundException e) { |
|
19 |
0
| throw new RDocOutputException("Could not create targetStream", getTarget(), e);
|
|
20 |
| } |
|
21 |
| } |
|
22 |
| } |