Class MultipartBody.Builder
java.lang.Object
io.micronaut.http.client.multipart.MultipartBody.Builder
- Enclosing class:
- MultipartBody
A builder class to add different
Part to MultipartBody.-
Method Summary
Modifier and TypeMethodDescriptionAdd a file object to MultipartBody.Add a file object to MultipartBody.Add bytes data to MultipartBody.Add bytes data to MultipartBody.Add a file object to MultipartBody.addPart(String name, String filename, MediaType contentType, InputStream data, long contentLength) Add a InputStream data to MultipartBody.Add a file object to MultipartBody.addPart(String name, String filename, InputStream data, long contentLength) Add a InputStream data to MultipartBody.build()CreatesMultipartBodyfrom the provided parts.
-
Method Details
-
addPart
Add a file object to MultipartBody.- Parameters:
name- Name of the parameter for file object to be passed in multipart requestfile- The file object to copy the content toFileUpload- Returns:
- A
MultipartBody.Builderto build MultipartBody
-
addPart
Add a file object to MultipartBody.- Parameters:
name- Name of the parameter for file object to be passed in multipart requestfilename- Name of the filefile- The file object to copy the content toFileUpload- Returns:
- A
MultipartBody.Builderto build MultipartBody
-
addPart
public MultipartBody.Builder addPart(String name, String filename, MediaType contentType, File file) Add a file object to MultipartBody.- Parameters:
name- Name of the parameter for file object to be passed in multipart requestfilename- Name of the filecontentType- File content of typeMediaType, possible values could be "text/plain", "application/json" etcfile- The file object to copy the content toFileUpload- Returns:
- A
MultipartBody.Builderto build MultipartBody
-
addPart
Add bytes data to MultipartBody.- Parameters:
name- Name of the parameter for file object to be passed in multipart requestfilename- Name of the filedata- A byte Array (byte[]) representing the contents of the file- Returns:
- A
MultipartBody.Builderto build MultipartBody
-
addPart
public MultipartBody.Builder addPart(String name, String filename, MediaType contentType, byte[] data) Add bytes data to MultipartBody.- Parameters:
name- Name of the parameter for file object to be passed in multipart requestfilename- Name of the filecontentType- The content type of File, possible values could be "text/plain", "application/json" etcdata- A byte Array (byte[]) representing the contents of the file- Returns:
- A
MultipartBody.Builderto build MultipartBody
-
addPart
public MultipartBody.Builder addPart(String name, String filename, InputStream data, long contentLength) Add a InputStream data to MultipartBody.- Parameters:
name- Name of the parameter for file object to be passed in multipart requestfilename- Name of the filedata- AnInputStreamdata value representing the content of file objectcontentLength- The size of the content- Returns:
- A
MultipartBody.Builderto build MultipartBody
-
addPart
public MultipartBody.Builder addPart(String name, String filename, MediaType contentType, InputStream data, long contentLength) Add a InputStream data to MultipartBody.- Parameters:
name- Name of the parameter for file object to be passed in multipart requestfilename- Name of the filecontentType- The content type of File, possible values could be "text/plain", "application/json" etcdata- AnInputStreamdata value representing the content of file objectcontentLength- The size of the content- Returns:
- A
MultipartBody.Builderto build MultipartBody
-
addPart
Add a file object to MultipartBody.- Parameters:
name- Name of the parameter or the key to be passed in multipart requestvalue- Plain String value for the parameter- Returns:
- A
MultipartBody.Builderto build MultipartBody
-
build
CreatesMultipartBodyfrom the provided parts.- Returns:
- The
MultipartBody - Throws:
MultipartException- If there are no parts
-