org.jboss.netty.handler.codec.http.websocketx

## Class CloseWebSocketFrame

- java.lang.Object
- - org.jboss.netty.handler.codec.http.websocketx.WebSocketFrame
  - - org.jboss.netty.handler.codec.http.websocketx.CloseWebSocketFrame

-     public class CloseWebSocketFrame
      extends WebSocketFrame

  Web Socket Frame for closing the connection

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CloseWebSocketFrame()` Creates a new empty close frame.
    `CloseWebSocketFrame(boolean finalFragment, int rsv)` Creates a new close frame with no losing status code and no reason text
    `CloseWebSocketFrame(boolean finalFragment, int rsv, ChannelBuffer binaryData)` Creates a new close frame
    `CloseWebSocketFrame(boolean finalFragment, int rsv, int statusCode, String reasonText)` Creates a new close frame with closing status code and reason text
    `CloseWebSocketFrame(int statusCode, String reasonText)` Creates a new empty close frame with closing status code and reason text

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getReasonText()` Returns the reason text as per RFC 6455 If a reason text is not supplied, an empty string is returned.
    `int` | `getStatusCode()` Returns the closing status code as per RFC 6455.
    `String` | `toString()`

    - ### Methods inherited from class org.jboss.netty.handler.codec.http.websocketx.WebSocketFrame

      `getBinaryData, getRsv, isFinalFragment, setBinaryData, setFinalFragment, setRsv`

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

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

- - ### Constructor Detail

    - #### CloseWebSocketFrame

          public CloseWebSocketFrame()

      Creates a new empty close frame.

    - #### CloseWebSocketFrame

          public CloseWebSocketFrame(int statusCode,
                             String reasonText)

      Creates a new empty close frame with closing status code and reason text
      Parameters:
        `statusCode` - Integer status code as per RFC 6455. For example, `1000` indicates normal closure.
        `reasonText` - Reason text. Set to null if no text.

    - #### CloseWebSocketFrame

          public CloseWebSocketFrame(boolean finalFragment,
                             int rsv)

      Creates a new close frame with no losing status code and no reason text
      Parameters:
        `finalFragment` - flag indicating if this frame is the final fragment
        `rsv` - reserved bits used for protocol extensions

    - #### CloseWebSocketFrame

          public CloseWebSocketFrame(boolean finalFragment,
                             int rsv,
                             int statusCode,
                             String reasonText)

      Creates a new close frame with closing status code and reason text
      Parameters:
        `finalFragment` - flag indicating if this frame is the final fragment
        `rsv` - reserved bits used for protocol extensions
        `statusCode` - Integer status code as per RFC 6455. For example, `1000` indicates normal closure.
        `reasonText` - Reason text. Set to null if no text.

    - #### CloseWebSocketFrame

          public CloseWebSocketFrame(boolean finalFragment,
                             int rsv,
                             ChannelBuffer binaryData)

      Creates a new close frame
      Parameters:
        `finalFragment` - flag indicating if this frame is the final fragment
        `rsv` - reserved bits used for protocol extensions
        `binaryData` - the content of the frame. Must be 2 byte integer followed by optional UTF-8 encoded string.

  - ### Method Detail

    - #### getStatusCode

          public int getStatusCode()

      Returns the closing status code as per RFC 6455. If a status code is set, -1 is returned.

    - #### getReasonText

          public String getReasonText()

      Returns the reason text as per RFC 6455 If a reason text is not supplied, an empty string is returned.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2008-2012 The Netty Project. All Rights Reserved.