1 /*
2 * Copyright 2012 The Netty Project
3 *
4 * The Netty Project licenses this file to you under the Apache License,
5 * version 2.0 (the "License"); you may not use this file except in compliance
6 * with the License. You may obtain a copy of the License at:
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations
14 * under the License.
15 */
16 package io.netty.handler.codec.http.multipart;
17
18 import io.netty.buffer.ByteBuf;
19
20 /**
21 * FileUpload interface that could be in memory, on temporary file or any other implementations.
22 *
23 * Most methods are inspired from java.io.File API.
24 */
25 public interface FileUpload extends HttpData {
26 /**
27 * Returns the original filename in the client's filesystem,
28 * as provided by the browser (or other client software).
29 * @return the original filename
30 */
31 String getFilename();
32
33 /**
34 * Set the original filename.
35 * <p>
36 * <strong>Note:</strong> This method validates that the filename is safe for including in an HTTP request,
37 * and will throw an exception if that's not the case.
38 */
39 void setFilename(String filename);
40
41 /**
42 * Set the Content Type passed by the browser if defined
43 * @param contentType Content Type to set - must be not null
44 */
45 void setContentType(String contentType);
46
47 /**
48 * Returns the content type passed by the browser or null if not defined.
49 * @return the content type passed by the browser or null if not defined.
50 */
51 String getContentType();
52
53 /**
54 * Set the Content-Transfer-Encoding type from String as 7bit, 8bit or binary
55 */
56 void setContentTransferEncoding(String contentTransferEncoding);
57
58 /**
59 * Returns the Content-Transfer-Encoding
60 * @return the Content-Transfer-Encoding
61 */
62 String getContentTransferEncoding();
63
64 @Override
65 FileUpload copy();
66
67 @Override
68 FileUpload duplicate();
69
70 @Override
71 FileUpload retainedDuplicate();
72
73 @Override
74 FileUpload replace(ByteBuf content);
75
76 @Override
77 FileUpload retain();
78
79 @Override
80 FileUpload retain(int increment);
81
82 @Override
83 FileUpload touch();
84
85 @Override
86 FileUpload touch(Object hint);
87 }