Class CloseWebSocketFrame
- java.lang.Object
-
- io.netty.buffer.DefaultByteBufHolder
-
- io.netty.handler.codec.http.websocketx.WebSocketFrame
-
- io.netty.handler.codec.http.websocketx.CloseWebSocketFrame
-
- All Implemented Interfaces:
ByteBufHolder
,ReferenceCounted
public class CloseWebSocketFrame extends WebSocketFrame
Web Socket Frame for closing the connection.
-
-
Constructor Summary
Constructors Constructor 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 textCloseWebSocketFrame(boolean finalFragment, int rsv, int statusCode, java.lang.String reasonText)
Creates a new close frame with closing status code and reason textCloseWebSocketFrame(boolean finalFragment, int rsv, ByteBuf binaryData)
Creates a new close frameCloseWebSocketFrame(int statusCode, java.lang.String reasonText)
Creates a new empty close frame with closing status code and reason textCloseWebSocketFrame(WebSocketCloseStatus status)
Creates a new empty close frame with closing status code and reason textCloseWebSocketFrame(WebSocketCloseStatus status, java.lang.String reasonText)
Creates a new empty close frame with closing status code and reason text
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CloseWebSocketFrame
copy()
Creates a deep copy of thisByteBufHolder
.CloseWebSocketFrame
duplicate()
Duplicates thisByteBufHolder
.java.lang.String
reasonText()
Returns the reason text as per RFC 6455 If a reason text is not supplied, an empty string is returned.CloseWebSocketFrame
replace(ByteBuf content)
Returns a newByteBufHolder
which contains the specifiedcontent
.CloseWebSocketFrame
retain()
Increases the reference count by1
.CloseWebSocketFrame
retain(int increment)
Increases the reference count by the specifiedincrement
.CloseWebSocketFrame
retainedDuplicate()
Duplicates thisByteBufHolder
.int
statusCode()
Returns the closing status code as per RFC 6455.CloseWebSocketFrame
touch()
Records the current access location of this object for debugging purposes.CloseWebSocketFrame
touch(java.lang.Object hint)
Records the current access location of this object with an additional arbitrary information for debugging purposes.-
Methods inherited from class io.netty.handler.codec.http.websocketx.WebSocketFrame
isFinalFragment, rsv, toString
-
Methods inherited from class io.netty.buffer.DefaultByteBufHolder
content, contentToString, equals, hashCode, refCnt, release, release
-
-
-
-
Constructor Detail
-
CloseWebSocketFrame
public CloseWebSocketFrame()
Creates a new empty close frame.
-
CloseWebSocketFrame
public CloseWebSocketFrame(WebSocketCloseStatus status)
Creates a new empty close frame with closing status code and reason text- Parameters:
status
- Status code as per RFC 6455. For example, 1000 indicates normal closure.
-
CloseWebSocketFrame
public CloseWebSocketFrame(WebSocketCloseStatus status, java.lang.String reasonText)
Creates a new empty close frame with closing status code and reason text- Parameters:
status
- Status code as per RFC 6455. For example, 1000 indicates normal closure.reasonText
- Reason text. Set to null if no text.
-
CloseWebSocketFrame
public CloseWebSocketFrame(int statusCode, java.lang.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 fragmentrsv
- reserved bits used for protocol extensions.
-
CloseWebSocketFrame
public CloseWebSocketFrame(boolean finalFragment, int rsv, int statusCode, java.lang.String reasonText)
Creates a new close frame with closing status code and reason text- Parameters:
finalFragment
- flag indicating if this frame is the final fragmentrsv
- reserved bits used for protocol extensionsstatusCode
- 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, ByteBuf binaryData)
Creates a new close frame- Parameters:
finalFragment
- flag indicating if this frame is the final fragmentrsv
- reserved bits used for protocol extensionsbinaryData
- the content of the frame. Must be 2 byte integer followed by optional UTF-8 encoded string.
-
-
Method Detail
-
statusCode
public int statusCode()
Returns the closing status code as per RFC 6455. If a status code is set, -1 is returned.
-
reasonText
public java.lang.String reasonText()
Returns the reason text as per RFC 6455 If a reason text is not supplied, an empty string is returned.
-
copy
public CloseWebSocketFrame copy()
Description copied from class:DefaultByteBufHolder
Creates a deep copy of thisByteBufHolder
.This method calls
replace(content().copy())
by default.- Specified by:
copy
in interfaceByteBufHolder
- Overrides:
copy
in classWebSocketFrame
-
duplicate
public CloseWebSocketFrame duplicate()
Description copied from class:DefaultByteBufHolder
Duplicates thisByteBufHolder
. Be aware that this will not automatically callByteBufHolder.retain()
.This method calls
replace(content().duplicate())
by default.- Specified by:
duplicate
in interfaceByteBufHolder
- Overrides:
duplicate
in classWebSocketFrame
-
retainedDuplicate
public CloseWebSocketFrame retainedDuplicate()
Description copied from class:DefaultByteBufHolder
Duplicates thisByteBufHolder
. This method returns a retained duplicate unlikeByteBufHolder.duplicate()
.This method calls
replace(content().retainedDuplicate())
by default.- Specified by:
retainedDuplicate
in interfaceByteBufHolder
- Overrides:
retainedDuplicate
in classWebSocketFrame
- See Also:
ByteBuf.retainedDuplicate()
-
replace
public CloseWebSocketFrame replace(ByteBuf content)
Description copied from class:DefaultByteBufHolder
Returns a newByteBufHolder
which contains the specifiedcontent
.Override this method to return a new instance of this object whose content is set to the specified
content
. The default implementation ofDefaultByteBufHolder.copy()
,DefaultByteBufHolder.duplicate()
andDefaultByteBufHolder.retainedDuplicate()
invokes this method to create a copy.- Specified by:
replace
in interfaceByteBufHolder
- Specified by:
replace
in classWebSocketFrame
-
retain
public CloseWebSocketFrame retain()
Description copied from interface:ReferenceCounted
Increases the reference count by1
.- Specified by:
retain
in interfaceByteBufHolder
- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classWebSocketFrame
-
retain
public CloseWebSocketFrame retain(int increment)
Description copied from interface:ReferenceCounted
Increases the reference count by the specifiedincrement
.- Specified by:
retain
in interfaceByteBufHolder
- Specified by:
retain
in interfaceReferenceCounted
- Overrides:
retain
in classWebSocketFrame
-
touch
public CloseWebSocketFrame touch()
Description copied from interface:ReferenceCounted
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 viaResourceLeakDetector
. This method is a shortcut totouch(null)
.- Specified by:
touch
in interfaceByteBufHolder
- Specified by:
touch
in interfaceReferenceCounted
- Overrides:
touch
in classWebSocketFrame
-
touch
public CloseWebSocketFrame touch(java.lang.Object hint)
Description copied from interface:ReferenceCounted
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 viaResourceLeakDetector
.- Specified by:
touch
in interfaceByteBufHolder
- Specified by:
touch
in interfaceReferenceCounted
- Overrides:
touch
in classWebSocketFrame
-
-