public class HTTPRequestContent
extends java.lang.Object
Constructor and Description |
---|
HTTPRequestContent()
Create a new, empty instance.
|
HTTPRequestContent(byte[] b)
Create a new instance and add the data of a byte array to the content.
|
Modifier and Type | Method and Description |
---|---|
void |
addContent(byte[] b)
Add the data of a byte array to the content.
|
void |
addContent(java.lang.String s)
Add the data of a string to the content.
|
void |
addContent(java.lang.String s,
java.nio.charset.Charset charset)
Add the data of a string to the content.
|
void |
clearContent()
Clear all data of the content.
|
long |
getContentSendTimeMillis()
Get the elapsed time duration for sending the content data.
|
long |
getContentSize()
Get the size of the content.
|
java.util.ArrayList<byte[]> |
getRawContent()
Get the raw content.
|
byte[] |
getRawMergedContent()
High-level function: Merge the raw content fragments to one byte array.
|
long |
getStartContentSendTimestamp()
Get the timestamp of the start of sending the content data.
|
JsonObject |
toJsonObject()
Get a JSON object of this instance (the raw request content in Base64 format, which can be also have a decoded size of zero bytes in case of no content).
|
public HTTPRequestContent()
public HTTPRequestContent(byte[] b)
b
- the byte array to add to the contentpublic void addContent(byte[] b)
b
- the byte array to add to the contentpublic void addContent(java.lang.String s)
s
- the string to add to the contentpublic void addContent(java.lang.String s, java.nio.charset.Charset charset)
s
- the string to add to the contentcharset
- the charsetpublic void clearContent()
public long getContentSize()
public long getStartContentSendTimestamp()
public long getContentSendTimeMillis()
public java.util.ArrayList<byte[]> getRawContent()
public byte[] getRawMergedContent() throws HTTPContentTooLargeException
HTTPContentTooLargeException
- if the content is larger than 2^31-1 bytespublic JsonObject toJsonObject() throws HTTPContentTooLargeException
HTTPContentTooLargeException
- if the content is larger than 2^31-1 bytes