org.vertx.java.core.http.impl.ws

## Class DefaultWebSocketFrame

- java.lang.Object
- - org.vertx.java.core.http.impl.ws.DefaultWebSocketFrame

All Implemented Interfaces:
  WebSocketFrame

    public class DefaultWebSocketFrame
    extends java.lang.Object
    implements WebSocketFrame

The default `WebSocketFrame` implementation.

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.vertx.java.core.http.impl.ws.WebSocketFrame

`WebSocketFrame.FrameType`

### Constructor Summary

Constructors
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.

### Method Summary

Methods
`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.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### DefaultWebSocketFrame

    public DefaultWebSocketFrame()

Creates a new empty text frame.

#### DefaultWebSocketFrame

    public DefaultWebSocketFrame(WebSocketFrame.FrameType frameType)

#### DefaultWebSocketFrame

    public DefaultWebSocketFrame(java.lang.String textData)

Creates a new text frame from with the specified string.

#### DefaultWebSocketFrame

    public DefaultWebSocketFrame(WebSocketFrame.FrameType type,
                         org.jboss.netty.buffer.ChannelBuffer binaryData)

Creates a new frame with the specified frame type and the specified data.

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

### Method Detail

#### getType

    public WebSocketFrame.FrameType getType()

Specified by:
  `getType` in interface `WebSocketFrame`

#### isText

    public boolean isText()

Description copied from interface: `WebSocketFrame`
Returns `true` if and only if the content of this frame is a string encoded in UTF-8.

Specified by:
  `isText` in interface `WebSocketFrame`

#### isBinary

    public boolean isBinary()

Description copied from interface: `WebSocketFrame`
Returns `true` if and only if the content of this frame is an arbitrary binary data.

Specified by:
  `isBinary` in interface `WebSocketFrame`

#### getBinaryData

    public org.jboss.netty.buffer.ChannelBuffer getBinaryData()

Description copied from interface: `WebSocketFrame`
Returns the content of this frame as-is, with no UTF-8 decoding.

Specified by:
  `getBinaryData` in interface `WebSocketFrame`

#### getTextData

    public java.lang.String getTextData()

Description copied from interface: `WebSocketFrame`
Converts the content of this frame into a UTF-8 string and returns the converted string.

Specified by:
  `getTextData` in interface `WebSocketFrame`

#### setBinaryData

    public void setBinaryData(org.jboss.netty.buffer.ChannelBuffer binaryData)

Description copied from interface: `WebSocketFrame`
Sets the type and the content of this frame.

Specified by:
  `setBinaryData` in interface `WebSocketFrame`
Parameters:
  `binaryData` - the content of the frame. If `(type & 0x80 == 0)`, it must be encoded in UTF-8.

#### setTextData

    public void setTextData(java.lang.String textData)

Specified by:
  `setTextData` in interface `WebSocketFrame`

#### toString

    public java.lang.String toString()

Description copied from interface: `WebSocketFrame`
Returns the string representation of this frame. Please note that this method is not identical to `WebSocketFrame.getTextData()`.

Specified by:
  `toString` in interface `WebSocketFrame`
Overrides:
  `toString` in class `java.lang.Object`