# Class WsRemoteEndpointBasic

java.lang.Object
org.apache.tomcat.websocket.WsRemoteEndpointBase
org.apache.tomcat.websocket.WsRemoteEndpointBasic

All Implemented Interfaces:
  `RemoteEndpoint, RemoteEndpoint.Basic`

public class WsRemoteEndpointBasic extends WsRemoteEndpointBase implements RemoteEndpoint.Basic
Synchronous (basic) remote endpoint for sending WebSocket messages.

- ## Nested Class Summary

  ### Nested classes/interfaces inherited from interface RemoteEndpoint

  `RemoteEndpoint.Async, RemoteEndpoint.Basic`

- ## Field Summary

  ### Fields inherited from class WsRemoteEndpointBase

  `base`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `OutputStream`
  `getSendStream()`
  `Writer`
  `getSendWriter()`
  `void`
  `sendBinary(ByteBuffer data)`
  Send the message, blocking until the message is sent.
  `void`
  `sendBinary(ByteBuffer partialByte, boolean isLast)`
  Sends part of a binary message to the remote endpoint.
  `void`
  `sendObject(Object o)`
  Encodes object as a message and sends it to the remote endpoint.
  `void`
  `sendText(String text)`
  Send the message, blocking until the message is sent.
  `void`
  `sendText(String fragment, boolean isLast)`
  Sends part of a text message to the remote endpoint.

  ### Methods inherited from class WsRemoteEndpointBase

  `flushBatch, getBatchingAllowed, sendPing, sendPong, setBatchingAllowed`

  ### Methods inherited from class Object

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

  ### Methods inherited from interface RemoteEndpoint

  `flushBatch, getBatchingAllowed, sendPing, sendPong, setBatchingAllowed`

- ## Method Details

  - ### sendText

    public void sendText(String text) throws IOException
    Description copied from interface: `javax.websocket.RemoteEndpoint.Basic`
    Send the message, blocking until the message is sent.
    Specified by:
      `sendText` in interface `RemoteEndpoint.Basic`
    Parameters:
      `text` - The text message to send.
    Throws:
      `IOException` - if an I/O error occurs during the sending of the message.

  - ### sendBinary

    public void sendBinary(ByteBuffer data) throws IOException
    Description copied from interface: `javax.websocket.RemoteEndpoint.Basic`
    Send the message, blocking until the message is sent.
    Specified by:
      `sendBinary` in interface `RemoteEndpoint.Basic`
    Parameters:
      `data` - The binary message to send
    Throws:
      `IOException` - if an I/O error occurs during the sending of the message.

  - ### sendText

    public void sendText(String fragment, boolean isLast) throws IOException
    Description copied from interface: `javax.websocket.RemoteEndpoint.Basic`
    Sends part of a text message to the remote endpoint. Once the first part of a message has been sent, no other text or binary messages may be sent until all remaining parts of this message have been sent.
    Specified by:
      `sendText` in interface `RemoteEndpoint.Basic`
    Parameters:
      `fragment` - The partial message to send
      `isLast` - `true` if this is the last part of the message, otherwise `false`
    Throws:
      `IOException` - if an I/O error occurs during the sending of the message.

  - ### sendBinary

    public void sendBinary(ByteBuffer partialByte, boolean isLast) throws IOException
    Description copied from interface: `javax.websocket.RemoteEndpoint.Basic`
    Sends part of a binary message to the remote endpoint. Once the first part of a message has been sent, no other text or binary messages may be sent until all remaining parts of this message have been sent.
    Specified by:
      `sendBinary` in interface `RemoteEndpoint.Basic`
    Parameters:
      `partialByte` - The partial message to send
      `isLast` - `true` if this is the last part of the message, otherwise `false`
    Throws:
      `IOException` - if an I/O error occurs during the sending of the message.

  - ### getSendStream

    public OutputStream getSendStream() throws IOException
    Specified by:
      `getSendStream` in interface `RemoteEndpoint.Basic`
    Throws:
      `IOException`

  - ### getSendWriter

    public Writer getSendWriter() throws IOException
    Specified by:
      `getSendWriter` in interface `RemoteEndpoint.Basic`
    Throws:
      `IOException`

  - ### sendObject

    public void sendObject(Object o) throws IOException, EncodeException
    Description copied from interface: `javax.websocket.RemoteEndpoint.Basic`
    Encodes object as a message and sends it to the remote endpoint.
    Specified by:
      `sendObject` in interface `RemoteEndpoint.Basic`
    Parameters:
      `o` - The object to be sent.
    Throws:
      `IOException` - if an I/O error occurs during the sending of the message.
      `EncodeException` - if there was a problem encoding the `data` object as a websocket message.