01: /*
02: * Created on 24.11.2004
03: */
04: package de.jwic.events;
05:
06: import java.io.IOException;
07: import java.io.InputStream;
08:
09: import de.jwic.base.Control;
10: import de.jwic.base.Event;
11: import de.jwic.upload.UploadFile;
12:
13: /**
14: * FileReceivedEvent contains the InputStream of an uploaded file with the FileUploadControl.
15: *
16: * $Id: FileReceivedEvent.java,v 1.3 2006/08/14 09:34:59 lordsam Exp $
17: * @version $Revision: 1.3 $
18: * @author JBornemann
19: */
20: public class FileReceivedEvent extends Event {
21:
22: private static final long serialVersionUID = 1L;
23: protected UploadFile file = null;
24:
25: /**
26: * FileReceivedEvent constructor.
27: * @param sourceControl
28: */
29: public FileReceivedEvent(Control sourceControl, UploadFile file) {
30: super (sourceControl);
31: this .file = file;
32: ;
33: }
34:
35: /**
36: * Returns the InputStream containing the uploaded file data.
37: * @return
38: * @throws IOException
39: */
40: public InputStream getInputStream() throws IOException {
41: return file.getInputStream();
42: }
43:
44: /**
45: * Returns the name of the uploaded file.
46: * @return
47: */
48: public String getFileName() {
49: return file.getName();
50: }
51:
52: /**
53: * Returns the name of the uploaded file.
54: * @return
55: */
56: public long getFileSize() {
57: return file.length();
58: }
59: }
|