01: // Copyright 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14:
15: package org.apache.tapestry.upload.services;
16:
17: import java.io.File;
18: import java.io.InputStream;
19:
20: import org.apache.tapestry.upload.components.Upload;
21:
22: /**
23: * Represents an uploaded file.
24: *
25: * @see Upload
26: */
27: public interface UploadedFile {
28: /**
29: * @return the MIME type specified when the file was uploaded.
30: */
31: String getContentType();
32:
33: /**
34: * @return the name of the file that was uploaded.
35: */
36: String getFileName();
37:
38: /**
39: * @return the complete path, as reported by the client browser.
40: */
41: String getFilePath();
42:
43: /**
44: * @return the size, in bytes, of the uploaded content.
45: */
46: long getSize();
47:
48: /**
49: * @return an input stream of the content of the file.
50: */
51: InputStream getStream();
52:
53: /**
54: * @return true if the uploaded content is in memory.
55: */
56: boolean isInMemory();
57:
58: /**
59: * Writes the content of the file to a known location.
60: *
61: * @param file
62: * Location to write file to
63: */
64: void write(File file);
65: }
|