Top Description Constructors Methods
io.netty.handler.codec.http.websocketx

public Class CloseWebSocketFrame

extends WebSocketFrame
Class Inheritance
Imports
io.netty.buffer.ByteBuf, .Unpooled, io.netty.util.CharsetUtil, io.netty.util.internal.StringUtil

Web Socket Frame for closing the connection.

Constructor Summary

AccessConstructor and Description
public
CloseWebSocketFrame()

Creates a new empty close frame.

public
CloseWebSocketFrame(WebSocketCloseStatus
Status code as per RFC 6455. For example, 1000 indicates normal closure.
status
)

Creates a new empty close frame with closing status code and reason text

public
CloseWebSocketFrame(WebSocketCloseStatus
Status code as per RFC 6455. For example, 1000 indicates normal closure.
status
,
String
Reason text. Set to null if no text.
reasonText
)

Creates a new empty close frame with closing status code and reason text

public
CloseWebSocketFrame(int
Integer status code as per RFC 6455. For example, 1000 indicates normal closure.
statusCode
,
String
Reason text. Set to null if no text.
reasonText
)

Creates a new empty close frame with closing status code and reason text

public
CloseWebSocketFrame(boolean
flag indicating if this frame is the final fragment
finalFragment
,
int
reserved bits used for protocol extensions.
rsv
)

Creates a new close frame with no losing status code and no reason text

public
CloseWebSocketFrame(boolean
flag indicating if this frame is the final fragment
finalFragment
,
int
reserved bits used for protocol extensions
rsv
,
int
Integer status code as per RFC 6455. For example, 1000 indicates normal closure.
statusCode
,
String
Reason text. Set to null if no text.
reasonText
)

Creates a new close frame with closing status code and reason text

public
CloseWebSocketFrame(boolean
flag indicating if this frame is the final fragment
finalFragment
,
int
reserved bits used for protocol extensions
rsv
,
ByteBuf
the content of the frame. Must be 2 byte integer followed by optional UTF-8 encoded string.
binaryData
)

Creates a new close frame

Method Summary

Modifier and TypeMethod and Description
public CloseWebSocketFrame
public CloseWebSocketFrame
private static ByteBuf
newBinaryData(int statusCode, String reasonText)

public String
reasonText()

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

public CloseWebSocketFrame
replace(ByteBuf content)

Implements abstract io.netty.handler.codec.http.websocketx.WebSocketFrame.replace.

Implements io.netty.buffer.ByteBufHolder.replace.

Returns a new ByteBufHolder which contains the specified content.
pack-priv static int
requireValidStatusCode(int statusCode)

public CloseWebSocketFrame
public CloseWebSocketFrame
retain(int increment)

Overrides io.netty.handler.codec.http.websocketx.WebSocketFrame.retain.

Implements io.netty.buffer.ByteBufHolder.retain.

Increases the reference count by the specified increment.
public CloseWebSocketFrame
public int
statusCode()

Returns the closing status code as per RFC 6455.

public CloseWebSocketFrame
touch()

Overrides io.netty.handler.codec.http.websocketx.WebSocketFrame.touch.

Implements io.netty.buffer.ByteBufHolder.touch.

Records the current access location of this object for debugging purposes.
public CloseWebSocketFrame
touch(Object hint)

Overrides io.netty.handler.codec.http.websocketx.WebSocketFrame.touch.

Implements io.netty.buffer.ByteBufHolder.touch.

Records the current access location of this object with an additional arbitrary information for debugging purposes.
Inherited from io.netty.handler.codec.http.websocketx.WebSocketFrame:
isFinalFragmentrsvtoString

Constructor Detail

CloseWebSocketFrameback to summary
public CloseWebSocketFrame()

Creates a new empty close frame.

CloseWebSocketFrameback to summary
public CloseWebSocketFrame(WebSocketCloseStatus status)

Creates a new empty close frame with closing status code and reason text

Parameters
status:WebSocketCloseStatus

Status code as per RFC 6455. For example, 1000 indicates normal closure.

CloseWebSocketFrameback to summary
public CloseWebSocketFrame(WebSocketCloseStatus status, String reasonText)

Creates a new empty close frame with closing status code and reason text

Parameters
status:WebSocketCloseStatus

Status code as per RFC 6455. For example, 1000 indicates normal closure.

reasonText:String

Reason text. Set to null if no text.

CloseWebSocketFrameback to summary
public CloseWebSocketFrame(int statusCode, String reasonText)

Creates a new empty close frame with closing status code and reason text

Parameters
statusCode:int

Integer status code as per RFC 6455. For example, 1000 indicates normal closure.

reasonText:String

Reason text. Set to null if no text.

CloseWebSocketFrameback to summary
public CloseWebSocketFrame(boolean finalFragment, int rsv)

Creates a new close frame with no losing status code and no reason text

Parameters
finalFragment:boolean

flag indicating if this frame is the final fragment

rsv:int

reserved bits used for protocol extensions.

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

Creates a new close frame with closing status code and reason text

Parameters
finalFragment:boolean

flag indicating if this frame is the final fragment

rsv:int

reserved bits used for protocol extensions

statusCode:int

Integer status code as per RFC 6455. For example, 1000 indicates normal closure.

reasonText:String

Reason text. Set to null if no text.

CloseWebSocketFrameback to summary
public CloseWebSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData)

Creates a new close frame

Parameters
finalFragment:boolean

flag indicating if this frame is the final fragment

rsv:int

reserved bits used for protocol extensions

binaryData:ByteBuf

the content of the frame. Must be 2 byte integer followed by optional UTF-8 encoded string.

Method Detail

copyback to summary
public CloseWebSocketFrame copy()

Overrides io.netty.handler.codec.http.websocketx.WebSocketFrame.copy.

Implements io.netty.buffer.ByteBufHolder.copy.

Doc from io.netty.buffer.DefaultByteBufHolder.copy.

Creates a deep copy of this ByteBufHolder.

This method calls replace(content().copy()) by default.

Annotations
@Override
duplicateback to summary
public CloseWebSocketFrame duplicate()

Overrides io.netty.handler.codec.http.websocketx.WebSocketFrame.duplicate.

Implements io.netty.buffer.ByteBufHolder.duplicate.

Doc from io.netty.buffer.DefaultByteBufHolder.duplicate.

Duplicates this ByteBufHolder. Be aware that this will not automatically call retain().

This method calls replace(content().duplicate()) by default.

Annotations
@Override
newBinaryDataback to summary
private static ByteBuf newBinaryData(int statusCode, String reasonText)
reasonTextback to summary
public String reasonText()

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

replaceback to summary
public CloseWebSocketFrame replace(ByteBuf content)

Implements abstract io.netty.handler.codec.http.websocketx.WebSocketFrame.replace.

Implements io.netty.buffer.ByteBufHolder.replace.

Doc from io.netty.buffer.DefaultByteBufHolder.replace.

Returns a new ByteBufHolder which contains the specified content.

Override this method to return a new instance of this object whose content is set to the specified content. The default implementation of copy(), duplicate() and retainedDuplicate() invokes this method to create a copy.

Annotations
@Override
requireValidStatusCodeback to summary
pack-priv static int requireValidStatusCode(int statusCode)
retainback to summary
public CloseWebSocketFrame retain()

Overrides io.netty.handler.codec.http.websocketx.WebSocketFrame.retain.

Implements io.netty.buffer.ByteBufHolder.retain.

Doc from io.netty.util.ReferenceCounted.retain.

Increases the reference count by 1.

Annotations
@Override
retainback to summary
public CloseWebSocketFrame retain(int increment)

Overrides io.netty.handler.codec.http.websocketx.WebSocketFrame.retain.

Implements io.netty.buffer.ByteBufHolder.retain.

Doc from io.netty.util.ReferenceCounted.retain.

Increases the reference count by the specified increment.

Annotations
@Override
retainedDuplicateback to summary
public CloseWebSocketFrame retainedDuplicate()

Overrides io.netty.handler.codec.http.websocketx.WebSocketFrame.retainedDuplicate.

Implements io.netty.buffer.ByteBufHolder.retainedDuplicate.

Doc from io.netty.buffer.DefaultByteBufHolder.retainedDuplicate.

Duplicates this ByteBufHolder. This method returns a retained duplicate unlike duplicate().

This method calls replace(content().retainedDuplicate()) by default.

Annotations
@Override
statusCodeback to summary
public int statusCode()

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

touchback to summary
public CloseWebSocketFrame touch()

Overrides io.netty.handler.codec.http.websocketx.WebSocketFrame.touch.

Implements io.netty.buffer.ByteBufHolder.touch.

Doc from io.netty.util.ReferenceCounted.touch.

Records the current access location of this object for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you via ResourceLeakDetector. This method is a shortcut to touch(null).

Annotations
@Override
touchback to summary
public CloseWebSocketFrame touch(Object hint)

Overrides io.netty.handler.codec.http.websocketx.WebSocketFrame.touch.

Implements io.netty.buffer.ByteBufHolder.touch.

Doc from io.netty.util.ReferenceCounted.touch.

Records the current access location of this object with an additional arbitrary information for debugging purposes. If this object is determined to be leaked, the information recorded by this operation will be provided to you via ResourceLeakDetector.

Annotations
@Override