org.apache.tomcat.util.net

## Class NioEndpoint.NioSocketWrapper

- java.lang.Object
- - org.apache.tomcat.util.net.SocketWrapperBase<NioChannel>
  - - org.apache.tomcat.util.net.NioEndpoint.NioSocketWrapper

- Enclosing class:
    NioEndpoint

      public static class NioEndpoint.NioSocketWrapper
      extends SocketWrapperBase<NioChannel>

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.tomcat.util.net.SocketWrapperBase

      `SocketWrapperBase.BlockingMode, SocketWrapperBase.CompletionCheck, SocketWrapperBase.CompletionHandlerCall, SocketWrapperBase.CompletionState, SocketWrapperBase.OperationState<A>, SocketWrapperBase.VectoredIOCompletionHandler<A>`

  - ### Field Summary

    - ### Fields inherited from class org.apache.tomcat.util.net.SocketWrapperBase

      `bufferedWriteSize, COMPLETE_READ, COMPLETE_READ_WITH_COMPLETION, COMPLETE_WRITE, COMPLETE_WRITE_WITH_COMPLETION, localAddr, localName, localPort, nonBlockingWriteBuffer, READ_DATA, readOperation, readPending, remoteAddr, remoteHost, remotePort, sm, socketBufferHandler, writeOperation, writePending`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NioEndpoint.NioSocketWrapper(NioChannel channel, NioEndpoint endpoint)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `awaitLatch(CountDownLatch latch, long timeout, TimeUnit unit)`
    `void` | `awaitReadLatch(long timeout, TimeUnit unit)`
    `void` | `awaitWriteLatch(long timeout, TimeUnit unit)`
    `void` | `close()`
    `SendfileDataBase` | `createSendfileData(String filename, long pos, long length)`
    `void` | `doClientAuth(SSLSupport sslSupport)` Require the client to perform CLIENT-CERT authentication if it hasn't already done so.
    `protected void` | `doWrite(boolean block, ByteBuffer from)` Write the contents of the ByteBuffer to the socket.
    `long` | `getLastRead()`
    `long` | `getLastWrite()`
    `NioEndpoint.Poller` | `getPoller()`
    `CountDownLatch` | `getReadLatch()`
    `NioEndpoint.SendfileData` | `getSendfileData()`
    `SSLSupport` | `getSslSupport(String clientCertProvider)`
    `CountDownLatch` | `getWriteLatch()`
    `int` | `interestOps()`
    `int` | `interestOps(int ops)`
    `boolean` | `isClosed()`
    `boolean` | `isReadyForRead()`
    `protected <A> SocketWrapperBase.OperationState<A>` | `newOperationState(boolean read, ByteBuffer[] buffers, int offset, int length, SocketWrapperBase.BlockingMode block, long timeout, TimeUnit unit, A attachment, SocketWrapperBase.CompletionCheck check, CompletionHandler<Long,? super A> handler, Semaphore semaphore, SocketWrapperBase.VectoredIOCompletionHandler<A> completion)`
    `protected void` | `populateLocalAddr()`
    `protected void` | `populateLocalName()`
    `protected void` | `populateLocalPort()`
    `protected void` | `populateRemoteAddr()`
    `protected void` | `populateRemoteHost()`
    `protected void` | `populateRemotePort()`
    `SendfileState` | `processSendfile(SendfileDataBase sendfileData)` Starts the sendfile process.
    `int` | `read(boolean block, byte[] b, int off, int len)`
    `int` | `read(boolean block, ByteBuffer to)`
    `void` | `registerReadInterest()`
    `void` | `registerWriteInterest()`
    `protected CountDownLatch` | `resetLatch(CountDownLatch latch)`
    `void` | `resetReadLatch()`
    `void` | `resetWriteLatch()`
    `void` | `setAppReadBufHandler(ApplicationBufferHandler handler)`
    `void` | `setPoller(NioEndpoint.Poller poller)`
    `void` | `setSendfileData(NioEndpoint.SendfileData sf)`
    `protected CountDownLatch` | `startLatch(CountDownLatch latch, int cnt)`
    `void` | `startReadLatch(int cnt)`
    `void` | `startWriteLatch(int cnt)`
    `void` | `updateLastRead()`
    `void` | `updateLastWrite()`

    - ### Methods inherited from class org.apache.tomcat.util.net.SocketWrapperBase

      `awaitReadComplete, awaitWriteComplete, buffersArrayHasRemaining, canWrite, checkError, decrementKeepAlive, doWrite, execute, flush, flushBlocking, flushNonBlocking, getEndpoint, getError, getLocalAddr, getLocalName, getLocalPort, getNegotiatedProtocol, getReadTimeout, getRemoteAddr, getRemoteHost, getRemotePort, getSocket, getSocketBufferHandler, getWriteTimeout, hasAsyncIO, hasDataToRead, hasDataToWrite, hasPerOperationTimeout, isReadPending, isReadyForWrite, isSecure, isUpgraded, isWritePending, needSemaphores, populateReadBuffer, populateReadBuffer, processSocket, read, read, read, setError, setKeepAliveLeft, setNegotiatedProtocol, setReadTimeout, setSecure, setUpgraded, setWriteTimeout, toString, transfer, transfer, unRead, vectoredOperation, write, write, write, write, write, writeBlocking, writeBlocking, writeNonBlocking, writeNonBlocking, writeNonBlockingInternal`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### NioEndpoint.NioSocketWrapper

          public NioEndpoint.NioSocketWrapper(NioChannel channel,
                                      NioEndpoint endpoint)

  - ### Method Detail

    - #### getPoller

          public NioEndpoint.Poller getPoller()

    - #### setPoller

          public void setPoller(NioEndpoint.Poller poller)

    - #### interestOps

          public int interestOps()

    - #### interestOps

          public int interestOps(int ops)

    - #### getReadLatch

          public CountDownLatch getReadLatch()

    - #### getWriteLatch

          public CountDownLatch getWriteLatch()

    - #### resetLatch

          protected CountDownLatch resetLatch(CountDownLatch latch)

    - #### resetReadLatch

          public void resetReadLatch()

    - #### resetWriteLatch

          public void resetWriteLatch()

    - #### startLatch

          protected CountDownLatch startLatch(CountDownLatch latch,
                                  int cnt)

    - #### startReadLatch

          public void startReadLatch(int cnt)

    - #### startWriteLatch

          public void startWriteLatch(int cnt)

    - #### awaitLatch

          protected void awaitLatch(CountDownLatch latch,
                        long timeout,
                        TimeUnit unit)
                             throws InterruptedException

      Throws:
        `InterruptedException`

    - #### awaitReadLatch

          public void awaitReadLatch(long timeout,
                            TimeUnit unit)
                              throws InterruptedException

      Throws:
        `InterruptedException`

    - #### awaitWriteLatch

          public void awaitWriteLatch(long timeout,
                             TimeUnit unit)
                               throws InterruptedException

      Throws:
        `InterruptedException`

    - #### setSendfileData

          public void setSendfileData(NioEndpoint.SendfileData sf)

    - #### getSendfileData

          public NioEndpoint.SendfileData getSendfileData()

    - #### updateLastWrite

          public void updateLastWrite()

    - #### getLastWrite

          public long getLastWrite()

    - #### updateLastRead

          public void updateLastRead()

    - #### getLastRead

          public long getLastRead()

    - #### isReadyForRead

          public boolean isReadyForRead()
                                 throws IOException

      Specified by:
        `isReadyForRead` in class `SocketWrapperBase<NioChannel>`
      Throws:
        `IOException`

    - #### read

          public int read(boolean block,
                 byte[] b,
                 int off,
                 int len)
                   throws IOException

      Specified by:
        `read` in class `SocketWrapperBase<NioChannel>`
      Throws:
        `IOException`

    - #### read

          public int read(boolean block,
                 ByteBuffer to)
                   throws IOException

      Specified by:
        `read` in class `SocketWrapperBase<NioChannel>`
      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in class `SocketWrapperBase<NioChannel>`
      Throws:
        `IOException`

    - #### isClosed

          public boolean isClosed()

      Specified by:
        `isClosed` in class `SocketWrapperBase<NioChannel>`

    - #### doWrite

          protected void doWrite(boolean block,
                     ByteBuffer from)
                          throws IOException

      Description copied from class: `SocketWrapperBase`
      Write the contents of the ByteBuffer to the socket. For blocking writes either then entire contents of the buffer will be written or an IOException will be thrown. Partial blocking writes will not occur.
      Specified by:
        `doWrite` in class `SocketWrapperBase<NioChannel>`
      Parameters:
        `block` - Should the write be blocking or not?
        `from` - the ByteBuffer containing the data to be written
      Throws:
        `IOException` - If an I/O error such as a timeout occurs during the write

    - #### registerReadInterest

          public void registerReadInterest()

      Specified by:
        `registerReadInterest` in class `SocketWrapperBase<NioChannel>`

    - #### registerWriteInterest

          public void registerWriteInterest()

      Specified by:
        `registerWriteInterest` in class `SocketWrapperBase<NioChannel>`

    - #### createSendfileData

          public SendfileDataBase createSendfileData(String filename,
                                            long pos,
                                            long length)

      Specified by:
        `createSendfileData` in class `SocketWrapperBase<NioChannel>`

    - #### processSendfile

          public SendfileState processSendfile(SendfileDataBase sendfileData)

      Description copied from class: `SocketWrapperBase`
      Starts the sendfile process. It is expected that if the sendfile process does not complete during this call and does not report an error, that the caller will not add the socket to the poller (or equivalent). That is the responsibility of this method.
      Specified by:
        `processSendfile` in class `SocketWrapperBase<NioChannel>`
      Parameters:
        `sendfileData` - Data representing the file to send
      Returns:
        The state of the sendfile process after the first write.

    - #### populateRemoteAddr

          protected void populateRemoteAddr()

      Specified by:
        `populateRemoteAddr` in class `SocketWrapperBase<NioChannel>`

    - #### populateRemoteHost

          protected void populateRemoteHost()

      Specified by:
        `populateRemoteHost` in class `SocketWrapperBase<NioChannel>`

    - #### populateRemotePort

          protected void populateRemotePort()

      Specified by:
        `populateRemotePort` in class `SocketWrapperBase<NioChannel>`

    - #### populateLocalName

          protected void populateLocalName()

      Specified by:
        `populateLocalName` in class `SocketWrapperBase<NioChannel>`

    - #### populateLocalAddr

          protected void populateLocalAddr()

      Specified by:
        `populateLocalAddr` in class `SocketWrapperBase<NioChannel>`

    - #### populateLocalPort

          protected void populateLocalPort()

      Specified by:
        `populateLocalPort` in class `SocketWrapperBase<NioChannel>`

    - #### getSslSupport

          public SSLSupport getSslSupport(String clientCertProvider)

      Specified by:
        `getSslSupport` in class `SocketWrapperBase<NioChannel>`
      Parameters:
        `clientCertProvider` - Ignored for this implementation

    - #### doClientAuth

          public void doClientAuth(SSLSupport sslSupport)
                            throws IOException

      Description copied from class: `SocketWrapperBase`
      Require the client to perform CLIENT-CERT authentication if it hasn't already done so.
      Specified by:
        `doClientAuth` in class `SocketWrapperBase<NioChannel>`
      Parameters:
        `sslSupport` - The SSL/TLS support instance currently being used by the connection that may need updating after the client authentication
      Throws:
        `IOException` - If authentication is required then there will be I/O with the client and this exception will be thrown if that goes wrong

    - #### setAppReadBufHandler

          public void setAppReadBufHandler(ApplicationBufferHandler handler)

      Specified by:
        `setAppReadBufHandler` in class `SocketWrapperBase<NioChannel>`

    - #### newOperationState

          protected <A> SocketWrapperBase.OperationState<A> newOperationState(boolean read,
                                                                  ByteBuffer[] buffers,
                                                                  int offset,
                                                                  int length,
                                                                  SocketWrapperBase.BlockingMode block,
                                                                  long timeout,
                                                                  TimeUnit unit,
                                                                  A attachment,
                                                                  SocketWrapperBase.CompletionCheck check,
                                                                  CompletionHandler<Long,? super A> handler,
                                                                  Semaphore semaphore,
                                                                  SocketWrapperBase.VectoredIOCompletionHandler<A> completion)

      Specified by:
        `newOperationState` in class `SocketWrapperBase<NioChannel>`

Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.