View Javadoc

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       * Get the file name of the part
13       *
14       * @return The file name of the part
15       */
16      String getName();
17  
18      /**
19       * Get the content type of the part
20       *
21       * @return The content type of the part
22       * @since 2.4
23       */
24      String getContentType();
25  
26      /**
27       * Write the part to the given file
28       *
29       * @param file The file to write the part to
30       * @since 2.4
31       */
32      void write(File file) throws IOException;
33  
34      /**
35       * Get the input stream of the part
36       *
37       * @return The input stream
38       * @throws IOException If an error occured
39       */
40      InputStream getInputStream() throws IOException;
41  
42      /**
43       * Get the simple value of the part
44       *
45       * @return The value
46       * @since 2.4
47       */
48      String getValue();
49  
50      /**
51       * Whether the part is a simple form field
52       *
53       * @return True if it's a simple form field
54       * @since 2.4
55       */
56      boolean isFormField();
57  
58      /**
59       * Retrieve the size of this FilePart, in bytes
60       *
61       * @since 3.0.15
62       */
63      long getSize();
64  }