## org.jboss.netty.handler.codec.http.websocket
Interface WebSocketFrame

All Known Implementing Classes:
  DefaultWebSocketFrame

    public interface WebSocketFrame

A Web Socket frame that represents either text or binary data.

Version:
  $Rev: 2342 $, $Date: 2010-07-07 14:07:39 +0900 (Wed, 07 Jul 2010) $
Author:
  The Netty Project, Trustin Lee

Field Summary
`static WebSocketFrame` `CLOSING_HANDSHAKE` Closing handshake message (`0xFF, 0x00`)

Method Summary
`ChannelBuffer` `getBinaryData()` Returns the content of this frame as-is, with no UTF-8 decoding.
`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.
`String` `toString()` Returns the string representation of this frame.

Field Detail

### CLOSING_HANDSHAKE

    static final WebSocketFrame CLOSING_HANDSHAKE

  Closing handshake message (`0xFF, 0x00`)

Method Detail

### getType

    int getType()

  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.

### isText

    boolean isText()

  Returns `true` if and only if the content of this frame is a string encoded in UTF-8.

### isBinary

    boolean isBinary()

  Returns `true` if and only if the content of this frame is an arbitrary binary data.

### getBinaryData

    ChannelBuffer getBinaryData()

  Returns the content of this frame as-is, with no UTF-8 decoding.

### getTextData

    String getTextData()

  Converts the content of this frame into a UTF-8 string and returns the converted string.

### setData

    void setData(int type,
                 ChannelBuffer binaryData)

  Sets the type and the content of this frame.

  Parameters:
    `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.
  Throws:
    `IllegalArgumentException` - if If `(type & 0x80 == 0)` and the data is not encoded in UTF-8

### toString

    String toString()

  Returns the string representation of this frame. Please note that this method is not identical to `getTextData()`.

  Overrides:
    `toString` in class `Object`

Copyright © 2008-2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.