public abstract class BodyProducer extends Object
| Constructor and Description |
|---|
BodyProducer() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
finished()
This method will get called after the last chunk of the body get sent successfully.
|
long |
getContentLength()
Returns the size of the content in bytes that this producer is going to produce.
|
abstract void |
handleError(Throwable cause)
This method will get called if there is any error raised when sending body chunks.
|
abstract io.netty.buffer.ByteBuf |
nextChunk()
Returns a
ByteBuf representing the next chunk of bytes to send. |
public long getContentLength()
If a negative number is returned, the size is unknown and the Content-Length header
won't be set and Transfer-Encoding: chunked will be used.
-1L is returned.public abstract io.netty.buffer.ByteBuf nextChunk()
throws Exception
ByteBuf representing the next chunk of bytes to send. If the returned
ByteBuf is an empty buffer, it signals the end of the streaming.Exception - if there is any errorpublic abstract void finished()
throws Exception
Exception - if there is any errorpublic abstract void handleError(@Nullable Throwable cause)
nextChunk() or finished() method.cause - the reason of the failure or null if the reason of failure is unknown.Copyright 2019 Cask, Inc. Licensed under the Apache License, Version 2.0