Package com.predic8.membrane.core.http
Class EmptyBody
java.lang.Object
com.predic8.membrane.core.http.AbstractBody
com.predic8.membrane.core.http.EmptyBody
-
Field Summary
Fields inherited from class com.predic8.membrane.core.http.AbstractBody
chunks, observers -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]Returns the body's content as a byte[] representation.intWarning: Calling this method will trigger reading the body from the client, disabling "streaming".protected byte[]booleanisRead()protected voidvoidwrite(AbstractBodyTransferrer out, boolean retainCopy) protected voidprotected voidprotected voidIs called when there are no observers that need to read the body.Methods inherited from class com.predic8.membrane.core.http.AbstractBody
discard, getContentAsStream, getObservers, getRaw, getTrailer, hasRelevantObservers, hasTrailer, markAsRead, read, setTrailer, toString, wasStreamed
-
Constructor Details
-
EmptyBody
public EmptyBody()
-
-
Method Details
-
getLength
public int getLength()Description copied from class:AbstractBodyWarning: Calling this method will trigger reading the body from the client, disabling "streaming". UseAbstractBody.isRead()to determine wether the body already has been read, if necessary.- Overrides:
getLengthin classAbstractBody- Returns:
- the length of the return value of
AbstractBody.getContent()
-
getContent
public byte[] getContent()Description copied from class:AbstractBodyReturns the body's content as a byte[] representation.For example,
AbstractBody.getContent()might return a byte representation ofWikipedia in chunks.
The return value does not differ whether "Transfer-Encoding: chunked" is used or not (see Chunked Transfer Encoding ), the example above is taken from there.Please note that a new array is allocated when calling
AbstractBody.getContent(). If you do not need the body as one single byte[], you should therefore useAbstractBody.getContentAsStream()instead.- Overrides:
getContentin classAbstractBody
-
readLocal
- Specified by:
readLocalin classAbstractBody- Throws:
IOException
-
writeAlreadyRead
- Specified by:
writeAlreadyReadin classAbstractBody- Throws:
IOException
-
writeNotRead
- Specified by:
writeNotReadin classAbstractBody- Throws:
IOException
-
writeStreamed
Description copied from class:AbstractBodyIs called when there are no observers that need to read the body. Streams the body without reading it- Specified by:
writeStreamedin classAbstractBody- Throws:
IOException
-
getRawLocal
- Specified by:
getRawLocalin classAbstractBody- Throws:
IOException
-
write
- Overrides:
writein classAbstractBody- Throws:
IOException
-
isRead
public boolean isRead()- Overrides:
isReadin classAbstractBody
-