|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
IUploadFile.java | - | - | - | - |
|
1 |
// Copyright 2004, 2005 The Apache Software Foundation
|
|
2 |
//
|
|
3 |
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4 |
// you may not use this file except in compliance with the License.
|
|
5 |
// You may obtain a copy of the License at
|
|
6 |
//
|
|
7 |
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8 |
//
|
|
9 |
// 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.request;
|
|
16 |
|
|
17 |
import java.io.File;
|
|
18 |
import java.io.InputStream;
|
|
19 |
|
|
20 |
/**
|
|
21 |
* Represents a file uploaded from a client side form.
|
|
22 |
*
|
|
23 |
* @author Howard Lewis Ship
|
|
24 |
* @since 1.0.8
|
|
25 |
*
|
|
26 |
**/
|
|
27 |
|
|
28 |
public interface IUploadFile |
|
29 |
{ |
|
30 |
/**
|
|
31 |
* Returns the name of the file that was uploaded. This
|
|
32 |
* is just the filename portion of the complete path.
|
|
33 |
*
|
|
34 |
**/
|
|
35 |
|
|
36 |
public String getFileName();
|
|
37 |
|
|
38 |
/**
|
|
39 |
* Returns the complete path, as reported by the client
|
|
40 |
* browser. Different browsers report different things
|
|
41 |
* here.
|
|
42 |
*
|
|
43 |
*
|
|
44 |
* @since 2.0.4
|
|
45 |
*
|
|
46 |
**/
|
|
47 |
|
|
48 |
public String getFilePath();
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Returns an input stream of the content of the file. There is no guarantee
|
|
52 |
* that this stream will be valid after the end of the current request cycle,
|
|
53 |
* so it should be processed immediately.
|
|
54 |
*
|
|
55 |
* <p>As of release 1.0.8, this will be a a {@link java.io.ByteArrayInputStream},
|
|
56 |
* but that, too, may change (a future implementation may upload the stream
|
|
57 |
* to a temporary file and return an input stream from that).
|
|
58 |
*
|
|
59 |
**/
|
|
60 |
|
|
61 |
public InputStream getStream();
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Returns the MIME type specified when the file was uploaded. May return null
|
|
65 |
* if the content type is not known.
|
|
66 |
*
|
|
67 |
* @since 2.2
|
|
68 |
*
|
|
69 |
**/
|
|
70 |
|
|
71 |
public String getContentType();
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Writes the content of the file to a known location. This should
|
|
75 |
* be invoked at most once. In a standard
|
|
76 |
* implementation based on Jakarta FileUpload, this will often
|
|
77 |
* be implemented efficiently as a file rename.
|
|
78 |
*
|
|
79 |
* @since 3.0
|
|
80 |
*/
|
|
81 |
|
|
82 |
public void write(File file); |
|
83 |
|
|
84 |
/**
|
|
85 |
* Returns true if the uploaded content is in memory. False generally
|
|
86 |
* means the content is stored in a temporary file.
|
|
87 |
*/
|
|
88 |
|
|
89 |
public boolean isInMemory(); |
|
90 |
|
|
91 |
/**
|
|
92 |
* Returns the size, in bytes, of the uploaded content.
|
|
93 |
*
|
|
94 |
* @since 3.0
|
|
95 |
**/
|
|
96 |
|
|
97 |
public long getSize(); |
|
98 |
} |
|