public class DefaultWebSocketFrame extends java.lang.Object implements WebSocketFrame, io.netty.util.ReferenceCounted
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,
io.netty.buffer.ByteBuf binaryData)
Creates a new frame with the specified frame type and the specified data.
|
| Modifier and Type | Method and Description |
|---|---|
io.netty.buffer.ByteBuf |
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. |
int |
refCnt() |
boolean |
release() |
boolean |
release(int decrement) |
io.netty.util.ReferenceCounted |
retain() |
io.netty.util.ReferenceCounted |
retain(int increment) |
void |
setBinaryData(io.netty.buffer.ByteBuf binaryData)
Sets the type and the content of this frame.
|
void |
setTextData(java.lang.String textData)
Set the type of the content of this frame and populate it with the given content
|
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, io.netty.buffer.ByteBuf 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 io.netty.buffer.ByteBuf getBinaryData()
WebSocketFramegetBinaryData in interface WebSocketFramepublic java.lang.String getTextData()
WebSocketFramegetTextData in interface WebSocketFramepublic void setBinaryData(io.netty.buffer.ByteBuf 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)
WebSocketFramesetTextData in interface WebSocketFrametextData - the content of the frame. Must be valid UTF-8public java.lang.String toString()
WebSocketFrameWebSocketFrame.getTextData().toString in interface WebSocketFrametoString in class java.lang.Objectpublic int refCnt()
refCnt in interface io.netty.util.ReferenceCountedpublic io.netty.util.ReferenceCounted retain()
retain in interface io.netty.util.ReferenceCountedpublic io.netty.util.ReferenceCounted retain(int increment)
retain in interface io.netty.util.ReferenceCountedpublic boolean release()
release in interface io.netty.util.ReferenceCountedpublic boolean release(int decrement)
release in interface io.netty.util.ReferenceCounted