Class NetworkTrafficSocketChannelEndPoint

All Implemented Interfaces:
Closeable, AutoCloseable, EndPoint, ManagedSelector.Selectable

public class NetworkTrafficSocketChannelEndPoint extends SocketChannelEndPoint

A specialized version of SocketChannelEndPoint that supports NetworkTrafficListeners.

  • Constructor Details

  • Method Details

    • fill

      public int fill(ByteBuffer buffer) throws IOException
      Description copied from interface: EndPoint
      Fill 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 it's capacity. The limit is updated to include the filled bytes.
      Specified by:
      fill in interface EndPoint
      Overrides:
      fill in class SocketChannelEndPoint
      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

      public boolean flush(ByteBuffer... buffers) throws IOException
      Description copied from interface: EndPoint
      Flush 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 interface EndPoint
      Overrides:
      flush in class SocketChannelEndPoint
      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 interface EndPoint
      Overrides:
      onOpen in class AbstractEndPoint
      See Also:
    • onClose

      public void onClose(Throwable failure)
      Description copied from interface: EndPoint

      Callback method invoked when this EndPoint is closed.

      Specified by:
      onClose in interface EndPoint
      Overrides:
      onClose in class SelectableChannelEndPoint
      Parameters:
      failure - The reason for the close, or null if a normal close.
      See Also:
    • notifyIncoming

      public void notifyIncoming(ByteBuffer buffer, int read)
    • notifyOutgoing

      public void notifyOutgoing(ByteBuffer view)