public class DefaultWebSocketFrame extends java.lang.Object implements WebSocketFrame
WebSocketFrame implementation.WebSocketFrame.FrameType| Constructor and Description |
|---|
DefaultWebSocketFrame()
Creates a new empty text frame.
|
DefaultWebSocketFrame(java.lang.String textData)
Creates a new text frame from with the specified string.
|
DefaultWebSocketFrame(WebSocketFrame.FrameType frameType) |
DefaultWebSocketFrame(WebSocketFrame.FrameType type,
org.jboss.netty.buffer.ChannelBuffer binaryData)
Creates a new frame with the specified frame type and the specified data.
|
| Modifier and Type | Method and Description |
|---|---|
org.jboss.netty.buffer.ChannelBuffer |
getBinaryData()
Returns the content of this frame as-is, with no UTF-8 decoding.
|
java.lang.String |
getTextData()
Converts the content of this frame into a UTF-8 string and returns the
converted string.
|
WebSocketFrame.FrameType |
getType() |
boolean |
isBinary()
Returns
true if and only if the content of this frame is an
arbitrary binary data. |
boolean |
isText()
Returns
true if and only if the content of this frame is a string
encoded in UTF-8. |
void |
setBinaryData(org.jboss.netty.buffer.ChannelBuffer binaryData)
Sets the type and the content of this frame.
|
void |
setTextData(java.lang.String textData) |
java.lang.String |
toString()
Returns the string representation of this frame.
|
public DefaultWebSocketFrame()
public DefaultWebSocketFrame(WebSocketFrame.FrameType frameType)
public DefaultWebSocketFrame(java.lang.String textData)
public DefaultWebSocketFrame(WebSocketFrame.FrameType type, org.jboss.netty.buffer.ChannelBuffer binaryData)
type - the type of the frame. 0 is the only allowed type currently.binaryData - the content of the frame. If (type & 0x80 == 0),
it must be encoded in UTF-8.java.lang.IllegalArgumentException - if If (type & 0x80 == 0) and the data is not encoded
in UTF-8public WebSocketFrame.FrameType getType()
getType in interface WebSocketFramepublic boolean isText()
WebSocketFrametrue if and only if the content of this frame is a string
encoded in UTF-8.isText in interface WebSocketFramepublic boolean isBinary()
WebSocketFrametrue if and only if the content of this frame is an
arbitrary binary data.isBinary in interface WebSocketFramepublic org.jboss.netty.buffer.ChannelBuffer getBinaryData()
WebSocketFramegetBinaryData in interface WebSocketFramepublic java.lang.String getTextData()
WebSocketFramegetTextData in interface WebSocketFramepublic void setBinaryData(org.jboss.netty.buffer.ChannelBuffer binaryData)
WebSocketFramesetBinaryData in interface WebSocketFramebinaryData - the content of the frame. If (type & 0x80 == 0),
it must be encoded in UTF-8.public void setTextData(java.lang.String textData)
setTextData in interface WebSocketFramepublic java.lang.String toString()
WebSocketFrameWebSocketFrame.getTextData().toString in interface WebSocketFrametoString in class java.lang.Object