Module io.netty5.transport
Package io.netty5.channel
Class DefaultMaxMessagesRecvBufferAllocator.MaxMessageHandle
- java.lang.Object
- 
- io.netty5.channel.DefaultMaxMessagesRecvBufferAllocator.MaxMessageHandle
 
- 
- All Implemented Interfaces:
- RecvBufferAllocator.Handle
 - Enclosing class:
- DefaultMaxMessagesRecvBufferAllocator
 
 public abstract class DefaultMaxMessagesRecvBufferAllocator.MaxMessageHandle extends Object implements RecvBufferAllocator.Handle Focuses on enforcing the maximum messages per read condition forcontinueReading(boolean).
- 
- 
Constructor SummaryConstructors Constructor Description MaxMessageHandle()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Bufferallocate(BufferAllocator 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(boolean autoRead)Determine if the current read loop should continue.booleancontinueReading(boolean autoRead, Predicate<RecvBufferAllocator.Handle> maybeMoreDataSupplier)Same asRecvBufferAllocator.Handle.continueReading(boolean)except "more data" is determined by the supplier parameter.voidincMessagesRead(int amt)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()OnlyChannelOption.MAX_MESSAGES_PER_READis used.protected inttotalBytesRead()- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface io.netty5.channel.RecvBufferAllocator.Handleguess
 
- 
 
- 
- 
- 
Method Detail- 
resetpublic void reset() OnlyChannelOption.MAX_MESSAGES_PER_READis used.- Specified by:
- resetin interface- RecvBufferAllocator.Handle
 
 - 
allocatepublic Buffer allocate(BufferAllocator alloc) Description copied from interface:RecvBufferAllocator.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 interface- RecvBufferAllocator.Handle
 
 - 
incMessagesReadpublic final void incMessagesRead(int amt) Description copied from interface:RecvBufferAllocator.HandleIncrement the number of messages that have been read for the current read loop.- Specified by:
- incMessagesReadin interface- RecvBufferAllocator.Handle
- Parameters:
- amt- The amount to increment by.
 
 - 
lastBytesReadpublic void lastBytesRead(int bytes) Description copied from interface:RecvBufferAllocator.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 interface- RecvBufferAllocator.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 to- RecvBufferAllocator.Handle.lastBytesRead(). A negative value will signal a termination condition enforced externally to this class and is not required to be enforced in- RecvBufferAllocator.Handle.continueReading(boolean).
 
 - 
lastBytesReadpublic final int lastBytesRead() Description copied from interface:RecvBufferAllocator.HandleGet the amount of bytes for the previous read operation.- Specified by:
- lastBytesReadin interface- RecvBufferAllocator.Handle
- Returns:
- The amount of bytes for the previous read operation.
 
 - 
continueReadingpublic boolean continueReading(boolean autoRead) Description copied from interface:RecvBufferAllocator.HandleDetermine if the current read loop should continue.- Specified by:
- continueReadingin interface- RecvBufferAllocator.Handle
- Parameters:
- autoRead- if autoread is used,- falseotherwise.
- Returns:
- trueif the read loop should continue reading.- falseif the read loop is complete.
 
 - 
continueReadingpublic boolean continueReading(boolean autoRead, Predicate<RecvBufferAllocator.Handle> maybeMoreDataSupplier)Description copied from interface:RecvBufferAllocator.HandleSame asRecvBufferAllocator.Handle.continueReading(boolean)except "more data" is determined by the supplier parameter.- Specified by:
- continueReadingin interface- RecvBufferAllocator.Handle
- Parameters:
- autoRead-- trueif autoread is used,- falseotherwise.
- maybeMoreDataSupplier- A Predicate that determines if there maybe more data to read.
- Returns:
- trueif the read loop should continue reading.- falseif the read loop is complete.
 
 - 
readCompletepublic void readComplete() Description copied from interface:RecvBufferAllocator.HandleThe read has completed.- Specified by:
- readCompletein interface- RecvBufferAllocator.Handle
 
 - 
attemptedBytesReadpublic int attemptedBytesRead() Description copied from interface:RecvBufferAllocator.HandleGet how many bytes the read operation will (or did) attempt to read.- Specified by:
- attemptedBytesReadin interface- RecvBufferAllocator.Handle
- Returns:
- How many bytes the read operation will (or did) attempt to read.
 
 - 
attemptedBytesReadpublic void attemptedBytesRead(int bytes) Description copied from interface:RecvBufferAllocator.HandleSet how many bytes the read operation will (or did) attempt to read.- Specified by:
- attemptedBytesReadin interface- RecvBufferAllocator.Handle
- Parameters:
- bytes- How many bytes the read operation will (or did) attempt to read.
 
 - 
totalBytesReadprotected final int totalBytesRead() 
 
- 
 
-