Interface Data

All Known Implementing Classes:
BinaryData, TextData

public interface Data
The Data interface represents a payload for a WebScoket frame. It can hold either binary data or text data. For performance binary frames are a better choice as all text frames need to be encoded as UTF-8 from the native UCS2 format.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    This returns the binary payload that is to be sent with a frame.
    This returns the text payload that is to be sent with a frame.
  • Method Details

    • getBinary

      byte[] getBinary()
      This returns the binary payload that is to be sent with a frame. It contains no headers or other meta data. If the original data was text this converts it to UTF-8.
      Returns:
      the binary payload to be sent with the frame
    • getText

      String getText()
      This returns the text payload that is to be sent with a frame. It contains no header information or meta data. Caution should be used with this method as binary payloads will encode to garbage when decoded as UTF-8.
      Returns:
      the text payload to be sent with the frame