01: /*
02: * $Header: /cvsroot/webman-cms/source/webman/com/teamkonzept/web/TKUploadFileInputStream.java,v 1.6 2000/05/29 15:24:53 alex Exp $
03: *
04: */
05: package com.teamkonzept.web;
06:
07: import java.io.*;
08:
09: import com.teamkonzept.lib.*;
10:
11: public class TKUploadFileInputStream extends TKReadOnceFileInputStream {
12:
13: public String uploadFileName;
14: public TKHashtable uploadHeader;
15:
16: public TKUploadFileInputStream(File file, String uploadFileName,
17: TKHashtable header) throws IOException {
18: super (file);
19: this .uploadFileName = uploadFileName;
20: this .uploadHeader = header;
21: }
22:
23: public String getUploadFileName() {
24: return uploadFileName;
25: }
26:
27: public TKHashtable getUploadHeader() {
28: return uploadHeader;
29: }
30:
31: public void saveAs(File dest) throws IOException {
32: FileOutputStream out = new FileOutputStream(dest);
33: byte[] buf = new byte[4 * 1024];
34: int read;
35: while (true) {
36: if ((read = read(buf)) == -1)
37: break;
38: out.write(buf, 0, read);
39: }
40: out.close();
41: close();
42: }
43:
44: //{{DECLARE_CONTROLS
45: //}}
46: }
|