Package org.simpleframework.http.socket
Interface Data
-
- All Known Implementing Classes:
BinaryData
,TextData
public interface Data
TheData
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description byte[]
getBinary()
This returns the binary payload that is to be sent with a frame.java.lang.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
java.lang.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
-
-