Class MultiPartFormContent
- java.lang.Object
-
- net.lenni0451.commons.httpclient.content.HttpContent
-
- net.lenni0451.commons.httpclient.content.impl.MultiPartFormContent
-
public class MultiPartFormContent extends HttpContent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMultiPartFormContent.FormPart
-
Field Summary
-
Fields inherited from class net.lenni0451.commons.httpclient.content.HttpContent
content
-
-
Constructor Summary
Constructors Constructor Description MultiPartFormContent()MultiPartFormContent(java.lang.String boundary)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiPartFormContentaddPart(java.lang.String name, HttpContent content)Add a new part to the form data.MultiPartFormContentaddPart(java.lang.String name, HttpContent content, java.lang.String fileName)Add a new part to the form data.MultiPartFormContentaddPart(MultiPartFormContent.FormPart part)Add a new part to the form data.protected byte[]compute()intgetContentLength()-
Methods inherited from class net.lenni0451.commons.httpclient.content.HttpContent
bytes, bytes, file, form, form, getAsBytes, getAsString, getAsString, getContentType, multiPartForm, streamed, string, string
-
-
-
-
Method Detail
-
addPart
public MultiPartFormContent addPart(java.lang.String name, HttpContent content)
Add a new part to the form data.- Parameters:
name- The name of the partcontent- The content of the part- Returns:
- This instance for chaining
- See Also:
MultiPartFormContent.FormPart
-
addPart
public MultiPartFormContent addPart(java.lang.String name, HttpContent content, @Nullable java.lang.String fileName)
Add a new part to the form data.- Parameters:
name- The name of the partcontent- The content of the partfileName- The file name of the part- Returns:
- This instance for chaining
-
addPart
public MultiPartFormContent addPart(MultiPartFormContent.FormPart part)
Add a new part to the form data.- Parameters:
part- The part to add- Returns:
- This instance for chaining
-
getContentLength
public int getContentLength()
- Specified by:
getContentLengthin classHttpContent- Returns:
- The content length
-
compute
@Nonnull protected byte[] compute() throws java.io.IOException- Specified by:
computein classHttpContent- Returns:
- The content
- Throws:
java.io.IOException- If an I/O error occurs
-
-