Package org.microproxy.http
Interface HttpContent
- All Superinterfaces:
HttpObject
- All Known Subinterfaces:
FullHttpMessage,FullHttpRequest,FullHttpResponse,LastHttpContent
- All Known Implementing Classes:
DefaultFullHttpRequest,DefaultFullHttpResponse,DefaultHttpContent,DefaultLastHttpContent,HttpCache.Answer,ServerReplay.Replayed
A piece of an HTTP message body.
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]content()Returns the live backing array of body bytes, not a copy.default StringReturns this body piece decoded as UTF-8.default StringcontentAsString(Charset charset) Decodes this body piece as text.default intReturns the number of bytes in this body piece.setContent(byte[] content) Replaces the body bytes of this piece.
-
Method Details
-
content
byte[] content()Returns the live backing array of body bytes, not a copy.- Returns:
- the live backing array of body bytes, not a copy
-
setContent
Replaces the body bytes of this piece.- Parameters:
content- new backing array, retained without copying- Returns:
- this content object
-
contentLength
default int contentLength()Returns the number of bytes in this body piece.- Returns:
- the number of bytes in this body piece
-
contentAsString
Decodes this body piece as text.- Parameters:
charset- character encoding to use- Returns:
- the decoded text
-
contentAsString
Returns this body piece decoded as UTF-8.- Returns:
- this body piece decoded as UTF-8
-