Class MultipartBody.Builder
- java.lang.Object
-
- io.micronaut.http.client.multipart.MultipartBody.Builder
-
- Enclosing class:
- MultipartBody
public static final class MultipartBody.Builder extends java.lang.ObjectA builder class to add differentParttoMultipartBody.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultipartBody.BuilderaddPart(java.lang.String name, java.io.File file)Add a file object to MultipartBody.MultipartBody.BuilderaddPart(java.lang.String name, java.lang.String value)Add a file object to MultipartBody.MultipartBody.BuilderaddPart(java.lang.String name, java.lang.String filename, byte[] data)Add bytes data to MultipartBody.MultipartBody.BuilderaddPart(java.lang.String name, java.lang.String filename, io.micronaut.http.MediaType contentType, byte[] data)Add bytes data to MultipartBody.MultipartBody.BuilderaddPart(java.lang.String name, java.lang.String filename, io.micronaut.http.MediaType contentType, java.io.File file)Add a file object to MultipartBody.MultipartBody.BuilderaddPart(java.lang.String name, java.lang.String filename, io.micronaut.http.MediaType contentType, java.io.InputStream data, long contentLength)Add a InputStream data to MultipartBody.MultipartBody.BuilderaddPart(java.lang.String name, java.lang.String filename, java.io.File file)Add a file object to MultipartBody.MultipartBody.BuilderaddPart(java.lang.String name, java.lang.String filename, java.io.InputStream data, long contentLength)Add a InputStream data to MultipartBody.MultipartBodybuild()CreatesMultipartBodyfrom the provided parts.
-
-
-
Method Detail
-
addPart
public MultipartBody.Builder addPart(java.lang.String name, java.io.File file)
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
public MultipartBody.Builder addPart(java.lang.String name, java.lang.String filename, java.io.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 filefile- The file object to copy the content toFileUpload- Returns:
- A
MultipartBody.Builderto build MultipartBody
-
addPart
public MultipartBody.Builder addPart(java.lang.String name, java.lang.String filename, io.micronaut.http.MediaType contentType, java.io.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
public MultipartBody.Builder addPart(java.lang.String name, java.lang.String filename, 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 filedata- A byte Array (byte[]) representing the contents of the file- Returns:
- A
MultipartBody.Builderto build MultipartBody
-
addPart
public MultipartBody.Builder addPart(java.lang.String name, java.lang.String filename, io.micronaut.http.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(java.lang.String name, java.lang.String filename, java.io.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(java.lang.String name, java.lang.String filename, io.micronaut.http.MediaType contentType, java.io.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
public MultipartBody.Builder addPart(java.lang.String name, java.lang.String value)
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
public MultipartBody build() throws io.micronaut.http.multipart.MultipartException
CreatesMultipartBodyfrom the provided parts.- Returns:
- The
MultipartBody - Throws:
io.micronaut.http.multipart.MultipartException- If there are no parts
-
-