1 | |
package org.apache.torque.mojo.morph; |
2 | |
|
3 | |
import java.io.File; |
4 | |
import java.io.FileInputStream; |
5 | |
import java.io.FileNotFoundException; |
6 | |
import java.io.FileOutputStream; |
7 | |
import java.io.InputStream; |
8 | |
import java.io.OutputStream; |
9 | |
|
10 | |
public class FileMorphRequest extends MorphRequest { |
11 | |
File oldFile; |
12 | |
File newFile; |
13 | |
|
14 | |
public FileMorphRequest(File oldFile, File newFile) { |
15 | 0 | super(); |
16 | 0 | this.oldFile = oldFile; |
17 | 0 | this.newFile = newFile; |
18 | 0 | } |
19 | |
|
20 | |
public FileMorphRequest() { |
21 | 0 | this(null, null); |
22 | 0 | } |
23 | |
|
24 | |
public File getOldFile() { |
25 | 0 | return oldFile; |
26 | |
} |
27 | |
|
28 | |
public void setOldFile(File oldFile) { |
29 | 0 | this.oldFile = oldFile; |
30 | 0 | } |
31 | |
|
32 | |
public File getNewFile() { |
33 | 0 | return newFile; |
34 | |
} |
35 | |
|
36 | |
public void setNewFile(File newFile) { |
37 | 0 | this.newFile = newFile; |
38 | 0 | } |
39 | |
|
40 | |
@Override |
41 | |
public InputStream getInputStream() { |
42 | |
try { |
43 | 0 | return new FileInputStream(oldFile); |
44 | 0 | } catch (FileNotFoundException e) { |
45 | 0 | throw new RuntimeException(e); |
46 | |
} |
47 | |
} |
48 | |
|
49 | |
@Override |
50 | |
public OutputStream getOutputStream() { |
51 | |
try { |
52 | 0 | return new FileOutputStream(newFile); |
53 | 0 | } catch (FileNotFoundException e) { |
54 | 0 | throw new RuntimeException(e); |
55 | |
} |
56 | |
} |
57 | |
|
58 | |
} |