public interface WebBody
Created by covers1624 on 1/8/23.
| Modifier and Type | Interface and Description |
|---|---|
static class |
WebBody.BytesBody
Simple
WebBody implementation reading from
an in-memory, byte[]. |
| Modifier and Type | Method and Description |
|---|---|
static WebBody |
bytes(byte[] bytes)
Create a
WebBody form a byte[]. |
static WebBody |
bytes(byte[] bytes,
java.lang.String contentType)
Create a
WebBody form a byte[]. |
java.lang.String |
contentType()
The mime content type for this data.
|
long |
length()
The length of the data.
|
boolean |
multiOpenAllowed()
Checks if this WebBody supports
open() being
called multiple times. |
java.io.InputStream |
open()
Open a stream to read the body data.
|
static WebBody |
string(java.lang.String str)
Create a
WebBody from a String. |
static WebBody |
string(java.lang.String str,
java.nio.charset.Charset charset)
Create a
WebBody from a String. |
static WebBody |
string(java.lang.String str,
java.nio.charset.Charset charset,
java.lang.String contentType)
Create a
WebBody from a String. |
static WebBody |
string(java.lang.String str,
java.lang.String contentType)
Create a
WebBody from a String. |
java.io.InputStream open()
throws java.io.IOException
java.io.IOException - If an IO error occurs.boolean multiOpenAllowed()
open() being
called multiple times.long length()
-1 for unknown.java.lang.String contentType()
static WebBody string(java.lang.String str)
WebBody from a String.
This method assumes null contentType
This method assumes StandardCharsets.UTF_8 charset.str - The string.WebBody.static WebBody string(java.lang.String str, java.lang.String contentType)
str - The string.contentType - The Content-Type for the body.WebBody.static WebBody string(java.lang.String str, java.nio.charset.Charset charset)
str - The string.charset - The Charset for the body.WebBody.static WebBody string(java.lang.String str, java.nio.charset.Charset charset, java.lang.String contentType)
WebBody from a String.str - The string.charset - The Charset for the body.contentType - The Content-Type for the body.WebBody.