Package org.eclipse.jetty.io
Class NetworkTrafficSocketChannelEndPoint
java.lang.Object
org.eclipse.jetty.io.IdleTimeout
org.eclipse.jetty.io.AbstractEndPoint
org.eclipse.jetty.io.SelectableChannelEndPoint
org.eclipse.jetty.io.SocketChannelEndPoint
org.eclipse.jetty.io.NetworkTrafficSocketChannelEndPoint
- All Implemented Interfaces:
Closeable
,AutoCloseable
,EndPoint
,ManagedSelector.Selectable
A specialized version of SocketChannelEndPoint
that supports NetworkTrafficListener
s.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.EndPoint
EndPoint.Pipe, EndPoint.SslSessionData, EndPoint.Wrapper
-
Field Summary
-
Constructor Summary
ConstructorDescriptionNetworkTrafficSocketChannelEndPoint
(SocketChannel channel, ManagedSelector selectSet, SelectionKey key, Scheduler scheduler, long idleTimeout, NetworkTrafficListener listener) -
Method Summary
Modifier and TypeMethodDescriptionint
fill
(ByteBuffer buffer) Fills the passed buffer with data from this endpoint.boolean
flush
(ByteBuffer... buffers) Flushes data from the passed header/buffer to this endpoint.void
notifyIncoming
(ByteBuffer buffer, int read) void
notifyOutgoing
(ByteBuffer view) void
Callback method invoked when thisEndPoint
is closed.void
onOpen()
Callback method invoked when this EndPoint is opened.Methods inherited from class org.eclipse.jetty.io.SocketChannelEndPoint
doShutdownOutput, getChannel, getRemoteSocketAddress
Methods inherited from class org.eclipse.jetty.io.SelectableChannelEndPoint
doClose, getLocalSocketAddress, getTransport, isOpen, needsFillInterest, onIncompleteFlush, onSelected, replaceKey, toEndPointString, updateKey
Methods inherited from class org.eclipse.jetty.io.AbstractEndPoint
close, close, doShutdownInput, fillInterested, getConnection, getCreatedTimeStamp, getFillInterest, getLocalAddress, getRemoteAddress, getWriteFlusher, isFillInterested, isInputShutdown, isOutputShutdown, onClose, onIdleExpired, reset, setConnection, shutdownInput, shutdownOutput, toConnectionString, toString, tryFillInterested, upgrade, write
Methods inherited from class org.eclipse.jetty.io.IdleTimeout
checkIdleTimeout, getIdleFor, getIdleTimeout, getScheduler, notIdle, setIdleTimeout
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.io.EndPoint
getIdleTimeout, getSslSessionData, isSecure, receive, send, setIdleTimeout, write
-
Constructor Details
-
NetworkTrafficSocketChannelEndPoint
public NetworkTrafficSocketChannelEndPoint(SocketChannel channel, ManagedSelector selectSet, SelectionKey key, Scheduler scheduler, long idleTimeout, NetworkTrafficListener listener)
-
-
Method Details
-
fill
Description copied from interface:EndPoint
Fills the passed buffer with data from this endpoint.
The bytes are appended to any data already in the buffer by writing from the buffers limit up to its capacity. The limit is updated to include the filled bytes.
- Specified by:
fill
in interfaceEndPoint
- Overrides:
fill
in classSocketChannelEndPoint
- Parameters:
buffer
- The buffer to fill. The position and limit are modified during the fill. After the operation, the position is unchanged and the limit is increased to reflect the new data filled.- Returns:
- an
int
value indicating the number of bytes filled or -1 if EOF is read or the input is shutdown. - Throws:
IOException
- if the endpoint is closed.
-
flush
Description copied from interface:EndPoint
Flushes data from the passed header/buffer to this endpoint.
As many bytes as can be consumed are taken from the header/buffer position up until the buffer limit. The header/buffers position is updated to indicate how many bytes have been consumed.
- Specified by:
flush
in interfaceEndPoint
- Overrides:
flush
in classSocketChannelEndPoint
- Parameters:
buffers
- the buffers to flush- Returns:
- True IFF all the buffers have been consumed and the endpoint has flushed the data to its destination (ie is not buffering any data).
- Throws:
IOException
- If the endpoint is closed or output is shutdown.
-
onOpen
public void onOpen()Description copied from interface:EndPoint
Callback method invoked when this EndPoint is opened.
- Specified by:
onOpen
in interfaceEndPoint
- Overrides:
onOpen
in classAbstractEndPoint
- See Also:
-
onClose
Description copied from interface:EndPoint
Callback method invoked when this
EndPoint
is closed.- Specified by:
onClose
in interfaceEndPoint
- Overrides:
onClose
in classSelectableChannelEndPoint
- Parameters:
failure
- The reason for the close, or null if a normal close.- See Also:
-
notifyIncoming
-
notifyOutgoing
-