1 package com.atlassian.plugins.rest.common.multipart;
2
3 import java.io.File;
4 import java.io.IOException;
5 import java.io.InputStream;
6
7 /**
8 * A part of a multi part request
9 */
10 public interface FilePart
11 {
12 /**
13 * Get the file name of the part
14 *
15 * @return The file name of the part
16 */
17 String getName();
18
19 /**
20 * Get the content type of the part
21 *
22 * @return The content type of the part
23 * @since 2.4
24 */
25 String getContentType();
26
27 /**
28 * Write the part to the given file
29 *
30 * @param file The file to write the part to
31 * @since 2.4
32 */
33 void write(File file) throws IOException;
34
35 /**
36 * Get the input stream of the part
37 *
38 * @return The input stream
39 * @throws IOException If an error occured
40 */
41 InputStream getInputStream() throws IOException;
42
43 /**
44 * Get the simple value of the part
45 *
46 * @return The value
47 * @since 2.4
48 */
49 String getValue();
50
51 /**
52 * Whether the part is a simple form field
53 *
54 * @return True if it's a simple form field
55 * @since 2.4
56 */
57 boolean isFormField();
58 }