Package org.apache.tomcat.websocket

## Class WsRemoteEndpointImplBase

- java.lang.Object
- - org.apache.tomcat.websocket.WsRemoteEndpointImplBase

All Implemented Interfaces:
  `RemoteEndpoint`

Direct Known Subclasses:
  `WsRemoteEndpointImplClient`, `WsRemoteEndpointImplServer`

    public abstract class WsRemoteEndpointImplBase
    extends java.lang.Object
    implements RemoteEndpoint

### Nested Class Summary

### Nested classes/interfaces inherited from interface javax.websocket.RemoteEndpoint

`RemoteEndpoint.Async, RemoteEndpoint.Basic`

### Field Summary

Fields
`protected static SendResult` `SENDRESULT_OK`
`protected static StringManager` `sm`

### Constructor Summary

Constructors
`WsRemoteEndpointImplBase()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`void` `close()`
`protected abstract void` `doClose()`
`protected abstract void` `doWrite​(SendHandler handler, long blockingWriteTimeoutExpiry, java.nio.ByteBuffer... data)`
`void` `flushBatch()` Flush any currently batched messages to the remote endpoint.
`boolean` `getBatchingAllowed()` Obtains the current batching status of the endpoint.
`java.io.OutputStream` `getSendStream()`
`long` `getSendTimeout()`
`java.io.Writer` `getSendWriter()`
`protected abstract boolean` `isMasked()`
`void` `sendBytes​(java.nio.ByteBuffer data)`
`void` `sendBytesByCompletion​(java.nio.ByteBuffer data, SendHandler handler)`
`java.util.concurrent.Future<java.lang.Void>` `sendBytesByFuture​(java.nio.ByteBuffer data)`
`void` `sendObject​(java.lang.Object obj)`
`void` `sendObjectByCompletion​(java.lang.Object obj, SendHandler completion)`
`java.util.concurrent.Future<java.lang.Void>` `sendObjectByFuture​(java.lang.Object obj)`
`void` `sendPartialBytes​(java.nio.ByteBuffer partialByte, boolean last)`
`void` `sendPartialString​(java.lang.String fragment, boolean isLast)`
`void` `sendPing​(java.nio.ByteBuffer applicationData)` Send a ping message blocking until the message has been sent.
`void` `sendPong​(java.nio.ByteBuffer applicationData)` Send a pong message blocking until the message has been sent.
`void` `sendString​(java.lang.String text)`
`void` `sendStringByCompletion​(java.lang.String text, SendHandler handler)`
`java.util.concurrent.Future<java.lang.Void>` `sendStringByFuture​(java.lang.String text)`
`void` `setBatchingAllowed​(boolean batchingAllowed)` Enable or disable the batching of outgoing messages for this endpoint.
`protected void` `setEncoders​(EndpointConfig endpointConfig)`
`void` `setSendTimeout​(long timeout)`
`protected void` `setSession​(WsSession wsSession)`
`protected void` `setTransformation​(Transformation transformation)`
`protected void` `updateStats​(long payloadLength)` Hook for updating server side statistics.

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

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

### Field Detail

#### sm

    protected static final StringManager sm

#### SENDRESULT_OK

    protected static final SendResult SENDRESULT_OK

### Constructor Detail

#### WsRemoteEndpointImplBase

    public WsRemoteEndpointImplBase()

### Method Detail

#### setTransformation

    protected void setTransformation​(Transformation transformation)

#### getSendTimeout

    public long getSendTimeout()

#### setSendTimeout

    public void setSendTimeout​(long timeout)

#### setBatchingAllowed

    public void setBatchingAllowed​(boolean batchingAllowed)
                            throws java.io.IOException

Description copied from interface: `javax.websocket.RemoteEndpoint`
Enable or disable the batching of outgoing messages for this endpoint. If batching is disabled when it was previously enabled then this method will block until any currently batched messages have been written.

Specified by:
  `setBatchingAllowed` in interface `RemoteEndpoint`
Parameters:
  `batchingAllowed` - New setting
Throws:
  `java.io.IOException` - If changing the value resulted in a call to `RemoteEndpoint.flushBatch()` and that call threw an `IOException`.

#### getBatchingAllowed

    public boolean getBatchingAllowed()

Description copied from interface: `javax.websocket.RemoteEndpoint`
Obtains the current batching status of the endpoint.

Specified by:
  `getBatchingAllowed` in interface `RemoteEndpoint`
Returns:
  `true` if batching is enabled, otherwise `false`.

#### flushBatch

    public void flushBatch()
                    throws java.io.IOException

Description copied from interface: `javax.websocket.RemoteEndpoint`
Flush any currently batched messages to the remote endpoint. This method will block until the flush completes.

Specified by:
  `flushBatch` in interface `RemoteEndpoint`
Throws:
  `java.io.IOException` - If an I/O error occurs while flushing

#### sendBytes

    public void sendBytes​(java.nio.ByteBuffer data)
                   throws java.io.IOException

Throws:
  `java.io.IOException`

#### sendBytesByFuture

    public java.util.concurrent.Future<java.lang.Void> sendBytesByFuture​(java.nio.ByteBuffer data)

#### sendBytesByCompletion

    public void sendBytesByCompletion​(java.nio.ByteBuffer data,
                                      SendHandler handler)

#### sendPartialBytes

    public void sendPartialBytes​(java.nio.ByteBuffer partialByte,
                                 boolean last)
                          throws java.io.IOException

Throws:
  `java.io.IOException`

#### sendPing

    public void sendPing​(java.nio.ByteBuffer applicationData)
                  throws java.io.IOException,
                         java.lang.IllegalArgumentException

Description copied from interface: `javax.websocket.RemoteEndpoint`
Send a ping message blocking until the message has been sent. Note that if a message is in the process of being sent asynchronously, this method will block until that message and this ping has been sent.

Specified by:
  `sendPing` in interface `RemoteEndpoint`
Parameters:
  `applicationData` - The payload for the ping message
Throws:
  `java.io.IOException` - If an I/O error occurs while sending the ping
  `java.lang.IllegalArgumentException` - if the applicationData is too large for a control message (max 125 bytes)

#### sendPong

    public void sendPong​(java.nio.ByteBuffer applicationData)
                  throws java.io.IOException,
                         java.lang.IllegalArgumentException

Description copied from interface: `javax.websocket.RemoteEndpoint`
Send a pong message blocking until the message has been sent. Note that if a message is in the process of being sent asynchronously, this method will block until that message and this pong has been sent.

Specified by:
  `sendPong` in interface `RemoteEndpoint`
Parameters:
  `applicationData` - The payload for the pong message
Throws:
  `java.io.IOException` - If an I/O error occurs while sending the pong
  `java.lang.IllegalArgumentException` - if the applicationData is too large for a control message (max 125 bytes)

#### sendString

    public void sendString​(java.lang.String text)
                    throws java.io.IOException

Throws:
  `java.io.IOException`

#### sendStringByFuture

    public java.util.concurrent.Future<java.lang.Void> sendStringByFuture​(java.lang.String text)

#### sendStringByCompletion

    public void sendStringByCompletion​(java.lang.String text,
                                       SendHandler handler)

#### sendPartialString

    public void sendPartialString​(java.lang.String fragment,
                                  boolean isLast)
                           throws java.io.IOException

Throws:
  `java.io.IOException`

#### getSendStream

    public java.io.OutputStream getSendStream()

#### getSendWriter

    public java.io.Writer getSendWriter()

#### updateStats

    protected void updateStats​(long payloadLength)

Hook for updating server side statistics. Called on every frame written (including when batching is enabled and the frames are buffered locally until the buffer is full or is flushed).

Parameters:
  `payloadLength` - Size of message payload

#### sendObject

    public void sendObject​(java.lang.Object obj)
                    throws java.io.IOException,
                           EncodeException

Throws:
  `java.io.IOException`
  `EncodeException`

#### sendObjectByFuture

    public java.util.concurrent.Future<java.lang.Void> sendObjectByFuture​(java.lang.Object obj)

#### sendObjectByCompletion

    public void sendObjectByCompletion​(java.lang.Object obj,
                                       SendHandler completion)

#### setSession

    protected void setSession​(WsSession wsSession)

#### setEncoders

    protected void setEncoders​(EndpointConfig endpointConfig)
                        throws DeploymentException

Throws:
  `DeploymentException`

#### close

    public final void close()

#### doWrite

    protected abstract void doWrite​(SendHandler handler,
                                    long blockingWriteTimeoutExpiry,
                                    java.nio.ByteBuffer... data)

#### isMasked

    protected abstract boolean isMasked()

#### doClose

    protected abstract void doClose()