org.jboss.netty.handler.codec.http.websocket
类 DefaultWebSocketFrame

java.lang.Object
  继承者 org.jboss.netty.handler.codec.http.websocket.DefaultWebSocketFrame
所有已实现的接口:
WebSocketFrame

public class DefaultWebSocketFrame
extends java.lang.Object
implements WebSocketFrame

The default WebSocketFrame implementation.


字段摘要
 
从接口 org.jboss.netty.handler.codec.http.websocket.WebSocketFrame 继承的字段
CLOSING_HANDSHAKE
 
构造方法摘要
DefaultWebSocketFrame()
          Creates a new empty text frame.
DefaultWebSocketFrame(int type, ChannelBuffer binaryData)
          Creates a new frame with the specified frame type and the specified data.
DefaultWebSocketFrame(java.lang.String textData)
          Creates a new text frame from with the specified string.
 
方法摘要
 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.
 int getType()
          Returns the type of this frame.
 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 setData(int type, ChannelBuffer binaryData)
          Sets the type and the content of this frame.
 java.lang.String toString()
          Returns the string representation of this frame.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

DefaultWebSocketFrame

public DefaultWebSocketFrame()
Creates a new empty text frame.


DefaultWebSocketFrame

public DefaultWebSocketFrame(java.lang.String textData)
Creates a new text frame from with the specified string.


DefaultWebSocketFrame

public DefaultWebSocketFrame(int type,
                             ChannelBuffer binaryData)
Creates a new frame with the specified frame type and the specified data.

参数:
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-8
方法详细信息

getType

public int getType()
从接口 WebSocketFrame 复制的描述
Returns the type of this frame. 0x00-0x7F means a text frame encoded in UTF-8, and 0x80-0xFF means a binary frame. Currently, 0 is the only allowed type according to the specification.

指定者:
接口 WebSocketFrame 中的 getType

isText

public boolean isText()
从接口 WebSocketFrame 复制的描述
Returns true if and only if the content of this frame is a string encoded in UTF-8.

指定者:
接口 WebSocketFrame 中的 isText

isBinary

public boolean isBinary()
从接口 WebSocketFrame 复制的描述
Returns true if and only if the content of this frame is an arbitrary binary data.

指定者:
接口 WebSocketFrame 中的 isBinary

getBinaryData

public ChannelBuffer getBinaryData()
从接口 WebSocketFrame 复制的描述
Returns the content of this frame as-is, with no UTF-8 decoding.

指定者:
接口 WebSocketFrame 中的 getBinaryData

getTextData

public java.lang.String getTextData()
从接口 WebSocketFrame 复制的描述
Converts the content of this frame into a UTF-8 string and returns the converted string.

指定者:
接口 WebSocketFrame 中的 getTextData

setData

public void setData(int type,
                    ChannelBuffer binaryData)
从接口 WebSocketFrame 复制的描述
Sets the type and the content of this frame.

指定者:
接口 WebSocketFrame 中的 setData
参数:
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.

toString

public java.lang.String toString()
从接口 WebSocketFrame 复制的描述
Returns the string representation of this frame. Please note that this method is not identical to WebSocketFrame.getTextData().

指定者:
接口 WebSocketFrame 中的 toString
覆盖:
java.lang.Object 中的 toString