Package io.netty.channel.kqueue
Class KQueueRecvByteAllocatorHandle
java.lang.Object
io.netty.channel.RecvByteBufAllocator.DelegatingHandle
io.netty.channel.kqueue.KQueueRecvByteAllocatorHandle
- All Implemented Interfaces:
RecvByteBufAllocator.ExtendedHandle
,RecvByteBufAllocator.Handle
final class KQueueRecvByteAllocatorHandle
extends RecvByteBufAllocator.DelegatingHandle
implements RecvByteBufAllocator.ExtendedHandle
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final UncheckedBooleanSupplier
private long
private boolean
private final PreferredDirectByteBufAllocator
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionallocate
(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.boolean
Determine if the current read loop should continue.boolean
continueReading
(UncheckedBooleanSupplier maybeMoreDataSupplier) Same asRecvByteBufAllocator.Handle.continueReading()
except "more data" is determined by the supplier parameter.int
guess()
Similar toRecvByteBufAllocator.Handle.allocate(ByteBufAllocator)
except that it does not allocate anything but just tells the capacity.private int
guess0()
(package private) boolean
void
lastBytesRead
(int bytes) Set the bytes that have been read for the last read operation.(package private) boolean
(package private) void
numberBytesPending
(long numberBytesPending) (package private) void
readEOF()
void
reset
(ChannelConfig config) Reset any counters that have accumulated and recommend how many messages/bytes should be read for the next read loop.Methods inherited from class io.netty.channel.RecvByteBufAllocator.DelegatingHandle
attemptedBytesRead, attemptedBytesRead, delegate, incMessagesRead, lastBytesRead, readComplete
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.netty.channel.RecvByteBufAllocator.Handle
attemptedBytesRead, attemptedBytesRead, incMessagesRead, lastBytesRead, readComplete
-
Field Details
-
preferredDirectByteBufAllocator
-
defaultMaybeMoreDataSupplier
-
overrideGuess
private boolean overrideGuess -
readEOF
private boolean readEOF -
numberBytesPending
private long numberBytesPending
-
-
Constructor Details
-
KQueueRecvByteAllocatorHandle
KQueueRecvByteAllocatorHandle(RecvByteBufAllocator.ExtendedHandle handle)
-
-
Method Details
-
guess
public int guess()Description copied from interface:RecvByteBufAllocator.Handle
Similar toRecvByteBufAllocator.Handle.allocate(ByteBufAllocator)
except that it does not allocate anything but just tells the capacity.- Specified by:
guess
in interfaceRecvByteBufAllocator.Handle
- Overrides:
guess
in classRecvByteBufAllocator.DelegatingHandle
-
reset
Description copied from interface:RecvByteBufAllocator.Handle
Reset 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:
reset
in interfaceRecvByteBufAllocator.Handle
- Overrides:
reset
in classRecvByteBufAllocator.DelegatingHandle
- Parameters:
config
- The channel configuration which may impact this object's behavior.
-
allocate
Description copied from interface:RecvByteBufAllocator.Handle
Creates 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:
allocate
in interfaceRecvByteBufAllocator.Handle
- Overrides:
allocate
in classRecvByteBufAllocator.DelegatingHandle
-
lastBytesRead
public void lastBytesRead(int bytes) Description copied from interface:RecvByteBufAllocator.Handle
Set 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:
lastBytesRead
in interfaceRecvByteBufAllocator.Handle
- Overrides:
lastBytesRead
in classRecvByteBufAllocator.DelegatingHandle
- 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()
.
-
continueReading
Description copied from interface:RecvByteBufAllocator.ExtendedHandle
Same asRecvByteBufAllocator.Handle.continueReading()
except "more data" is determined by the supplier parameter.- Specified by:
continueReading
in interfaceRecvByteBufAllocator.ExtendedHandle
- Parameters:
maybeMoreDataSupplier
- A supplier that determines if there maybe more data to read.
-
continueReading
public boolean continueReading()Description copied from interface:RecvByteBufAllocator.Handle
Determine if the current read loop should continue.- Specified by:
continueReading
in interfaceRecvByteBufAllocator.Handle
- Overrides:
continueReading
in classRecvByteBufAllocator.DelegatingHandle
- Returns:
true
if the read loop should continue reading.false
if the read loop is complete.
-
readEOF
void readEOF() -
isReadEOF
boolean isReadEOF() -
numberBytesPending
void numberBytesPending(long numberBytesPending) -
maybeMoreDataToRead
boolean maybeMoreDataToRead() -
guess0
private int guess0()
-