1
1
/*
2
- * Copyright 2002-2016 the original author or authors.
2
+ * Copyright 2002-2017 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
27
27
*
28
28
* <p>The file contents are either stored in memory or temporarily on disk.
29
29
* In either case, the user is responsible for copying file contents to a
30
- * session-level or persistent store as and if desired. The temporary storages
30
+ * session-level or persistent store as and if desired. The temporary storage
31
31
* will be cleared at the end of request processing.
32
32
*
33
33
* @author Juergen Hoeller
@@ -50,6 +50,8 @@ public interface MultipartFile extends InputStreamSource {
50
50
* but it typically will not with any other than Opera.
51
51
* @return the original filename, or the empty String if no file has been chosen
52
52
* in the multipart form, or {@code null} if not defined or not available
53
+ * @see org.apache.commons.fileupload.FileItem#getName()
54
+ * @see org.springframework.web.multipart.commons.CommonsMultipartFile#setPreserveFilename
53
55
*/
54
56
String getOriginalFilename ();
55
57
@@ -81,7 +83,7 @@ public interface MultipartFile extends InputStreamSource {
81
83
82
84
/**
83
85
* Return an InputStream to read the contents of the file from.
84
- * The user is responsible for closing the stream.
86
+ * <p> The user is responsible for closing the returned stream.
85
87
* @return the contents of the file as stream, or an empty stream if empty
86
88
* @throws IOException in case of access errors (if the temporary store fails)
87
89
*/
@@ -91,18 +93,22 @@ public interface MultipartFile extends InputStreamSource {
91
93
/**
92
94
* Transfer the received file to the given destination file.
93
95
* <p>This may either move the file in the filesystem, copy the file in the
94
- * filesystem, or save memory-held contents to the destination file.
95
- * If the destination file already exists, it will be deleted first.
96
- * <p>If the file has been moved in the filesystem, this operation cannot
97
- * be invoked again. Therefore, call this method just once to be able to
98
- * work with any storage mechanism.
99
- * <p><strong>Note:</strong> when using Servlet 3.0 multipart support you
100
- * need to configure the location relative to which files will be copied
101
- * as explained in {@link javax.servlet.http.Part#write}.
102
- * @param dest the destination file
96
+ * filesystem, or save memory-held contents to the destination file. If the
97
+ * destination file already exists, it will be deleted first.
98
+ * <p>If the target file has been moved in the filesystem, this operation
99
+ * cannot be invoked again afterwards. Therefore, call this method just once
100
+ * in order to work with any storage mechanism.
101
+ * <p><b>NOTE:</b> Depending on the underlying provider, temporary storage
102
+ * may be container-dependent, including the base directory for relative
103
+ * destinations specified here (e.g. with Servlet 3.0 multipart handling).
104
+ * For absolute destinations, the target file may get renamed/moved from its
105
+ * temporary location or newly copied, even if a temporary copy already exists.
106
+ * @param dest the destination file (typically absolute)
103
107
* @throws IOException in case of reading or writing errors
104
108
* @throws IllegalStateException if the file has already been moved
105
109
* in the filesystem and is not available anymore for another transfer
110
+ * @see org.apache.commons.fileupload.FileItem#write(File)
111
+ * @see javax.servlet.http.Part#write(String)
106
112
*/
107
113
void transferTo (File dest ) throws IOException , IllegalStateException ;
108
114
0 commit comments