java.lang.Object
org.miaixz.bus.http.bodys.MultipartBody.Part
- Enclosing class:
MultipartBody
A part of a multipart body.
-
Method Summary
Modifier and TypeMethodDescriptionbody()Returns the body of this part.static MultipartBody.Partcreate(RequestBody body) Creates a new part with no headers.static MultipartBody.Partcreate(Headers headers, RequestBody body) Creates a new part with the given headers and body.static MultipartBody.PartcreateFormData(String name, String value) Creates a new form-data part.static MultipartBody.PartcreateFormData(String name, String filename, RequestBody body) Creates a new form-data part with a filename.headers()Returns the headers of this part.
-
Method Details
-
create
Creates a new part with no headers.- Parameters:
body- The request body.- Returns:
- A new
MultipartBody.Partinstance. - Throws:
NullPointerException- if body is null.
-
create
Creates a new part with the given headers and body.- Parameters:
headers- The headers.body- The request body.- Returns:
- A new
MultipartBody.Partinstance. - Throws:
NullPointerException- if body is null.IllegalArgumentException- if headers contains Content-Type or Content-Length.
-
createFormData
Creates a new form-data part.- Parameters:
name- The field name.value- The field value.- Returns:
- A new
MultipartBody.Partinstance. - Throws:
NullPointerException- if name is null.
-
createFormData
Creates a new form-data part with a filename.- Parameters:
name- The field name.filename- The filename.body- The request body.- Returns:
- A new
MultipartBody.Partinstance. - Throws:
NullPointerException- if name is null.
-
headers
Returns the headers of this part.- Returns:
- The headers, which may be null.
-
body
Returns the body of this part.- Returns:
- The request body.
-