public class Part<T> extends Object implements Serializable
| 限定符和类型 | 方法和说明 |
|---|---|
T |
body()
The part body
|
@Nullable Charset |
charset()
The charset of this part's content.
|
Part<T> |
charset(Charset charset)
The charset of this part's content.
|
@Nullable String |
contentType()
The content type of the part.
|
Part<T> |
contentType(String contentType)
Set content type for this part.
|
static Part<File> |
file(String name,
File file)
Create a file multi-part field, from file.
|
static Part<byte[]> |
file(String name,
String fileName,
byte[] bytes)
Create a file multi-part field, from byte array data.
|
static Part<File> |
file(String name,
String fileName,
File file)
Create a file multi-part field, from file.
|
static Part<InputStream> |
file(String name,
String fileName,
InputStream in)
已过时。
Http body may be send multi times(because of redirect or other reasons), use
file(String, String, InputStreamSupplier) instead. |
static Part<InputStreamSupplier> |
file(String name,
String fileName,
InputStreamSupplier supplier)
Create a file multi-part field, from InputStream.
|
@Nullable String |
fileName()
The filename of th part. may be null if not exists
|
T |
getBody()
已过时。
use
body() |
@Nullable Charset |
getCharset()
已过时。
use
charset() |
@Nullable String |
getContentType()
已过时。
use
contentType() |
@Nullable String |
getFileName()
已过时。
use
fileName() |
String |
getName()
已过时。
use
name() |
String |
name()
The part field name
|
static Part<String> |
param(String name,
String value)
已过时。
use
text(String, String) instead. |
static Part<String> |
text(String name,
String value)
Create a text multi-part field.
|
void |
writeTo(OutputStream out)
Write part content to output stream.
|
public Part<T> charset(Charset charset)
charset - the charsetpublic static Part<File> file(String name, File file)
public static Part<File> file(String name, String fileName, File file)
@Deprecated public static Part<InputStream> file(String name, String fileName, InputStream in)
file(String, String, InputStreamSupplier) instead.public static Part<InputStreamSupplier> file(String name, String fileName, InputStreamSupplier supplier)
public static Part<byte[]> file(String name, String fileName, byte[] bytes)
public static Part<String> text(String name, String value)
@Deprecated public static Part<String> param(String name, String value)
text(String, String) instead.@Deprecated public String getName()
name()@Deprecated public @Nullable String getFileName()
fileName()@Deprecated public T getBody()
body()@Deprecated public @Nullable String getContentType()
contentType()@Deprecated public @Nullable Charset getCharset()
charset()public String name()
public @Nullable String fileName()
public T body()
public @Nullable String contentType()
public @Nullable Charset charset()
public void writeTo(OutputStream out) throws IOException
IOExceptionCopyright © 2019. All rights reserved.