Package com.predic8.membrane.core.http
Class ChunkedBody
java.lang.Object
com.predic8.membrane.core.http.AbstractBody
com.predic8.membrane.core.http.ChunkedBody
Reads the body with "Transfer-Encoding: chunked".
See ChunkedBodyTransferrer for writing a body using chunks.
-
Field Summary
Fields inherited from class com.predic8.membrane.core.http.AbstractBody
chunks, observers -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddiscard()intWarning: Calling this method will trigger reading the body from the client, disabling "streaming".protected intprotected byte[]booleanbooleanisRead()protected voidvoidread()static intprotected voidbooleansetTrailer(Header trailer) voidwrite(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
getContent, getObservers, getRaw, hasRelevantObservers, toString, wasStreamed
-
Constructor Details
-
ChunkedBody
-
-
Method Details
-
readChunkSize
- Throws:
IOException
-
read
- Overrides:
readin classAbstractBody- Throws:
IOException
-
write
- Overrides:
writein classAbstractBody- Throws:
IOException
-
markAsRead
protected void markAsRead()- Overrides:
markAsReadin classAbstractBody
-
readLocal
- Specified by:
readLocalin classAbstractBody- Throws:
IOException
-
discard
- Overrides:
discardin classAbstractBody- Throws:
IOException
-
getContentAsStream
- Overrides:
getContentAsStreamin classAbstractBody
-
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
-
getRawLength
- Throws:
IOException
-
getRawLocal
- Specified by:
getRawLocalin classAbstractBody- Throws:
IOException
-
writeAlreadyRead
- Specified by:
writeAlreadyReadin classAbstractBody- Throws:
IOException
-
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() - Throws:
IOException
-
isRead
public boolean isRead()- Overrides:
isReadin classAbstractBody
-
hasTrailer
public boolean hasTrailer()- Overrides:
hasTrailerin classAbstractBody
-
getTrailer
- Overrides:
getTrailerin classAbstractBody
-
setTrailer
- Overrides:
setTrailerin classAbstractBody- Returns:
- true, when the body supports trailers and the trailer was therefore set.
-