Package com.aliucord
Class Http.MultiPartBuilder
-
- All Implemented Interfaces:
-
java.io.Closeable
,java.lang.AutoCloseable
public class Http.MultiPartBuilder implements Closeable
Utility to build MultiPart requests
-
-
Constructor Summary
Constructors Constructor Description Http.MultiPartBuilder(String boundary)
Http.MultiPartBuilder(String boundary, OutputStream os)
Construct a new MultiPartBuilder writing to the provided OutputStream
-
Method Summary
Modifier and Type Method Description Http.MultiPartBuilder
appendFile(@NonNull() String fieldName, @NonNull() File uploadFile)
Append file. Http.MultiPartBuilder
appendStream(@NonNull() String fieldName, @NonNull() InputStream is)
Append InputStream. Http.MultiPartBuilder
appendField(@NonNull() String fieldName, @NonNull() String value)
Append field. Array<byte>
getBytes()
Build the finished byte array void
finish()
Finishes this MultiPartForm. void
close()
-
-
Constructor Detail
-
Http.MultiPartBuilder
Http.MultiPartBuilder(String boundary)
-
Http.MultiPartBuilder
Http.MultiPartBuilder(String boundary, OutputStream os)
Construct a new MultiPartBuilder writing to the provided OutputStream- Parameters:
boundary
- Boundaryos
- OutputStream to write to.
-
-
Method Detail
-
appendFile
@NonNull() Http.MultiPartBuilder appendFile(@NonNull() String fieldName, @NonNull() File uploadFile)
Append file. Will automatically be encoded for you
- Parameters:
fieldName
- The parameter field nameuploadFile
- The parameter file
-
appendStream
@NonNull() Http.MultiPartBuilder appendStream(@NonNull() String fieldName, @NonNull() InputStream is)
Append InputStream. Will automatically be encoded for you
- Parameters:
fieldName
- The parameter field nameis
- The parameter stream
-
appendField
@NonNull() Http.MultiPartBuilder appendField(@NonNull() String fieldName, @NonNull() String value)
Append field. Will automatically be encoded for you
- Parameters:
fieldName
- The parameter field namevalue
- The parameter value
-
getBytes
@NonNull()@Deprecated() Array<byte> getBytes()
Build the finished byte array
-
finish
void finish()
Finishes this MultiPartForm. This should be called last. Calling any other methods on this Builder after calling this will lead to undefined behaviour.
-
close
void close()
-
-
-
-