View Javadoc

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  		super();
16  		this.oldFile = oldFile;
17  		this.newFile = newFile;
18  	}
19  
20  	public FileMorphRequest() {
21  		this(null, null);
22  	}
23  
24  	public File getOldFile() {
25  		return oldFile;
26  	}
27  
28  	public void setOldFile(File oldFile) {
29  		this.oldFile = oldFile;
30  	}
31  
32  	public File getNewFile() {
33  		return newFile;
34  	}
35  
36  	public void setNewFile(File newFile) {
37  		this.newFile = newFile;
38  	}
39  
40  	@Override
41  	public InputStream getInputStream() {
42  		try {
43  			return new FileInputStream(oldFile);
44  		} catch (FileNotFoundException e) {
45  			throw new RuntimeException(e);
46  		}
47  	}
48  
49  	@Override
50  	public OutputStream getOutputStream() {
51  		try {
52  			return new FileOutputStream(newFile);
53  		} catch (FileNotFoundException e) {
54  			throw new RuntimeException(e);
55  		}
56  	}
57  
58  }