org.simpleframework.http.socket
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.

Author:
Niall Gallagher
See Also:
DataFrame

Method Summary
 byte[] getBinary()
          This returns the binary payload that is to be sent with a frame.
 String getText()
          This returns the text payload that is to be sent with a frame.
 

Method Detail

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


Copyright © 2014. All Rights Reserved.