Package io.netty.channel
Class RecvByteBufAllocator.DelegatingHandle
- java.lang.Object
-
- io.netty.channel.RecvByteBufAllocator.DelegatingHandle
-
- All Implemented Interfaces:
RecvByteBufAllocator.Handle
- Enclosing interface:
- RecvByteBufAllocator
public static class RecvByteBufAllocator.DelegatingHandle extends java.lang.Object implements RecvByteBufAllocator.Handle
ARecvByteBufAllocator.Handlewhich delegates all call to some otherRecvByteBufAllocator.Handle.
-
-
Constructor Summary
Constructors Constructor Description DelegatingHandle(RecvByteBufAllocator.Handle delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBufallocate(ByteBufAllocator alloc)Creates a new receive buffer whose capacity is probably large enough to read all inbound data and small enough not to waste its space.intattemptedBytesRead()Get how many bytes the read operation will (or did) attempt to read.voidattemptedBytesRead(int bytes)Set how many bytes the read operation will (or did) attempt to read.booleancontinueReading()Determine if the current read loop should continue.protected RecvByteBufAllocator.Handledelegate()Get theRecvByteBufAllocator.Handlewhich all methods will be delegated to.intguess()Similar toRecvByteBufAllocator.Handle.allocate(ByteBufAllocator)except that it does not allocate anything but just tells the capacity.voidincMessagesRead(int numMessages)Increment the number of messages that have been read for the current read loop.intlastBytesRead()Get the amount of bytes for the previous read operation.voidlastBytesRead(int bytes)Set the bytes that have been read for the last read operation.voidreadComplete()The read has completed.voidreset(ChannelConfig config)Reset any counters that have accumulated and recommend how many messages/bytes should be read for the next read loop.
-
-
-
Constructor Detail
-
DelegatingHandle
public DelegatingHandle(RecvByteBufAllocator.Handle delegate)
-
-
Method Detail
-
delegate
protected final RecvByteBufAllocator.Handle delegate()
Get theRecvByteBufAllocator.Handlewhich all methods will be delegated to.- Returns:
- the
RecvByteBufAllocator.Handlewhich all methods will be delegated to.
-
allocate
public ByteBuf allocate(ByteBufAllocator alloc)
Description copied from interface:RecvByteBufAllocator.HandleCreates a new receive buffer whose capacity is probably large enough to read all inbound data and small enough not to waste its space.- Specified by:
allocatein interfaceRecvByteBufAllocator.Handle
-
guess
public int guess()
Description copied from interface:RecvByteBufAllocator.HandleSimilar toRecvByteBufAllocator.Handle.allocate(ByteBufAllocator)except that it does not allocate anything but just tells the capacity.- Specified by:
guessin interfaceRecvByteBufAllocator.Handle
-
reset
public void reset(ChannelConfig config)
Description copied from interface:RecvByteBufAllocator.HandleReset any counters that have accumulated and recommend how many messages/bytes should be read for the next read loop.This may be used by
This is only ever a hint and may be ignored by the implementation.RecvByteBufAllocator.Handle.continueReading()to determine if the read operation should complete.- Specified by:
resetin interfaceRecvByteBufAllocator.Handle- Parameters:
config- The channel configuration which may impact this object's behavior.
-
incMessagesRead
public void incMessagesRead(int numMessages)
Description copied from interface:RecvByteBufAllocator.HandleIncrement the number of messages that have been read for the current read loop.- Specified by:
incMessagesReadin interfaceRecvByteBufAllocator.Handle- Parameters:
numMessages- The amount to increment by.
-
lastBytesRead
public void lastBytesRead(int bytes)
Description copied from interface:RecvByteBufAllocator.HandleSet the bytes that have been read for the last read operation. This may be used to increment the number of bytes that have been read.- Specified by:
lastBytesReadin interfaceRecvByteBufAllocator.Handle- Parameters:
bytes- The number of bytes from the previous read operation. This may be negative if an read error occurs. If a negative value is seen it is expected to be return on the next call toRecvByteBufAllocator.Handle.lastBytesRead(). A negative value will signal a termination condition enforced externally to this class and is not required to be enforced inRecvByteBufAllocator.Handle.continueReading().
-
lastBytesRead
public int lastBytesRead()
Description copied from interface:RecvByteBufAllocator.HandleGet the amount of bytes for the previous read operation.- Specified by:
lastBytesReadin interfaceRecvByteBufAllocator.Handle- Returns:
- The amount of bytes for the previous read operation.
-
continueReading
public boolean continueReading()
Description copied from interface:RecvByteBufAllocator.HandleDetermine if the current read loop should continue.- Specified by:
continueReadingin interfaceRecvByteBufAllocator.Handle- Returns:
trueif the read loop should continue reading.falseif the read loop is complete.
-
attemptedBytesRead
public int attemptedBytesRead()
Description copied from interface:RecvByteBufAllocator.HandleGet how many bytes the read operation will (or did) attempt to read.- Specified by:
attemptedBytesReadin interfaceRecvByteBufAllocator.Handle- Returns:
- How many bytes the read operation will (or did) attempt to read.
-
attemptedBytesRead
public void attemptedBytesRead(int bytes)
Description copied from interface:RecvByteBufAllocator.HandleSet how many bytes the read operation will (or did) attempt to read.- Specified by:
attemptedBytesReadin interfaceRecvByteBufAllocator.Handle- Parameters:
bytes- How many bytes the read operation will (or did) attempt to read.
-
readComplete
public void readComplete()
Description copied from interface:RecvByteBufAllocator.HandleThe read has completed.- Specified by:
readCompletein interfaceRecvByteBufAllocator.Handle
-
-