Class AbstractNioByteChannel
java.lang.Object
io.netty.util.DefaultAttributeMap
io.netty.channel.AbstractChannel
io.netty.channel.nio.AbstractNioChannel
io.netty.channel.nio.AbstractNioByteChannel
- All Implemented Interfaces:
Channel, ChannelOutboundInvoker, AttributeMap, Comparable<Channel>
- Direct Known Subclasses:
NioDomainSocketChannel, NioSocketChannel, NioUdtByteConnectorChannel
AbstractNioChannel base class for Channels that operate on bytes.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class AbstractNioChannel
AbstractNioChannel.AbstractNioUnsafe, AbstractNioChannel.NioUnsafeNested classes/interfaces inherited from class AbstractChannel
AbstractChannel.AbstractUnsafeNested classes/interfaces inherited from interface Channel
Channel.Unsafe -
Field Summary
Fields inherited from class AbstractNioChannel
readInterestOp, readOps -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractNioByteChannel(Channel parent, SelectableChannel ch) Create a new instance -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidprotected abstract intdoReadBytes(ByteBuf buf) Read bytes into the givenByteBufand return the amount.protected voidFlush the content of the given buffer to the remote peer.protected final intWrite objects to the OS.protected abstract intdoWriteBytes(ByteBuf buf) protected abstract longdoWriteFileRegion(FileRegion region) Write aFileRegionprotected final ObjectInvoked when a new message is added to aChannelOutboundBufferof thisAbstractChannel, so that theChannelimplementation converts the message to another.protected final voidincompleteWrite(boolean setOpWrite) protected booleanmetadata()protected AbstractNioChannel.AbstractNioUnsafeCreate a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannelprotected final voidprotected abstract ChannelFutureShutdown the input side of the channel.Methods inherited from class AbstractNioChannel
addAndSubmit, clearReadPending, doBeginRead, doClose, doConnect, doDeregister, doFinishConnect, doRegister, isCompatible, isOpen, isReadPending, javaChannel, newDirectBuffer, newDirectBuffer, registration, removeAndSubmit, selectionKey, setReadPending, unsafeMethods inherited from class AbstractChannel
closeFuture, compareTo, doBind, doDisconnect, doRegister, doShutdownOutput, equals, eventLoop, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, localAddress, localAddress0, maxMessagesPerWrite, newChannelPipeline, newId, parent, pipeline, remoteAddress, remoteAddress0, toString, validateFileRegion, voidPromiseMethods inherited from class DefaultAttributeMap
attr, hasAttrMethods inherited from interface AttributeMap
attr, hasAttrMethods inherited from interface Channel
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, config, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, flush, getOption, isActive, isWritable, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, read, setOption, write, write, writeAndFlush, writeAndFlush
-
Constructor Details
-
AbstractNioByteChannel
Create a new instance- Parameters:
parent- the parentChannelby which this instance was created. May benullch- the underlyingSelectableChannelon which it operates
-
-
Method Details
-
shutdownInput
Shutdown the input side of the channel. -
isInputShutdown0
protected boolean isInputShutdown0() -
newUnsafe
Description copied from class:AbstractChannelCreate a newAbstractChannel.AbstractUnsafeinstance which will be used for the life-time of theChannel- Specified by:
newUnsafein classAbstractChannel
-
metadata
Description copied from interface:Channel -
doWrite0
Write objects to the OS.- Parameters:
in- the collection which contains objects to write.- Returns:
- The value that should be decremented from the write quantum which starts at
ChannelConfig.getWriteSpinCount(). The typical use cases are as follows:- 0 - if no write was attempted. This is appropriate if an empty
ByteBuf(or other empty content) is encountered - 1 - if a single call to write data was made to the OS
ChannelUtils.WRITE_STATUS_SNDBUF_FULL- if an attempt to write data was made to the OS, but no data was accepted
- 0 - if no write was attempted. This is appropriate if an empty
- Throws:
Exception- if an I/O exception occurs during write.
-
doWrite
Description copied from class:AbstractChannelFlush the content of the given buffer to the remote peer.- Specified by:
doWritein classAbstractChannel- Throws:
Exception
-
filterOutboundMessage
Description copied from class:AbstractChannelInvoked when a new message is added to aChannelOutboundBufferof thisAbstractChannel, so that theChannelimplementation converts the message to another. (e.g. heap buffer -> direct buffer)- Overrides:
filterOutboundMessagein classAbstractChannel
-
incompleteWrite
protected final void incompleteWrite(boolean setOpWrite) -
doWriteFileRegion
Write aFileRegion- Parameters:
region- theFileRegionfrom which the bytes should be written- Returns:
- amount the amount of written bytes
- Throws:
Exception
-
doReadBytes
-
doWriteBytes
-
setOpWrite
protected final void setOpWrite() -
clearOpWrite
protected final void clearOpWrite()
-