Class MultipartFormDataBodyPublisher
java.lang.Object
io.github.yskszk63.jnhttpmultipartformdatabodypublisher.MultipartFormDataBodyPublisher
- All Implemented Interfaces:
java.net.http.HttpRequest.BodyPublisher
,Flow.Publisher<ByteBuffer>
public class MultipartFormDataBodyPublisher
extends Object
implements java.net.http.HttpRequest.BodyPublisher
multipart/form-data BodyPublisher.
-
Constructor Summary
ConstructorDescriptionConstructMultipartFormDataBodyPublisher
MultipartFormDataBodyPublisher
(Charset charset) ConstructMultipartFormDataBodyPublisher
-
Method Summary
Modifier and TypeMethodDescriptionAdd part.addChannel
(String name, String filename, java.util.function.Supplier<ReadableByteChannel> supplier) Add part withReadableByteChannel
addChannel
(String name, String filename, java.util.function.Supplier<ReadableByteChannel> supplier, String contentType) Add part withReadableByteChannel
Add part.Add part.addStream
(String name, String filename, java.util.function.Supplier<InputStream> supplier) Add part withInputStream
addStream
(String name, String filename, java.util.function.Supplier<InputStream> supplier, String contentType) Add part withInputStream
long
Get Content-Typevoid
subscribe
(Flow.Subscriber<? super ByteBuffer> s)
-
Constructor Details
-
MultipartFormDataBodyPublisher
public MultipartFormDataBodyPublisher()ConstructMultipartFormDataBodyPublisher
-
MultipartFormDataBodyPublisher
ConstructMultipartFormDataBodyPublisher
- Parameters:
charset
- character encoding
-
-
Method Details
-
add
Add part.- Parameters:
name
- field namevalue
- field value- Returns:
- this
-
addFile
Add part. Content using specified path.- Parameters:
name
- field namepath
- field value- Returns:
- this
-
addFile
Add part. Content using specified path.- Parameters:
name
- field namepath
- field valuecontentType
- Content-Type- Returns:
- this
-
addStream
public MultipartFormDataBodyPublisher addStream(String name, String filename, java.util.function.Supplier<InputStream> supplier) Add part withInputStream
- Parameters:
name
- field namefilename
- file namesupplier
- field value- Returns:
- this
-
addStream
public MultipartFormDataBodyPublisher addStream(String name, String filename, java.util.function.Supplier<InputStream> supplier, String contentType) Add part withInputStream
- Parameters:
name
- field namefilename
- file namesupplier
- field valuecontentType
- Content-Type- Returns:
- this
-
addChannel
public MultipartFormDataBodyPublisher addChannel(String name, String filename, java.util.function.Supplier<ReadableByteChannel> supplier) Add part withReadableByteChannel
- Parameters:
name
- field namefilename
- file namesupplier
- field value- Returns:
- this
-
addChannel
public MultipartFormDataBodyPublisher addChannel(String name, String filename, java.util.function.Supplier<ReadableByteChannel> supplier, String contentType) Add part withReadableByteChannel
- Parameters:
name
- field namefilename
- file namesupplier
- field valuecontentType
- Content-Type- Returns:
- this
-
contentType
Get Content-Type- Returns:
- Content-Type
-
subscribe
- Specified by:
subscribe
in interfaceFlow.Publisher<ByteBuffer>
-
contentLength
public long contentLength()- Specified by:
contentLength
in interfacejava.net.http.HttpRequest.BodyPublisher
-