Top Description Fields Constructors Methods
io.vertx.core.http.impl.ws

public Class WebSocketFrameImpl

extends Object
implements WebSocketFrameInternal, ReferenceCounted
Class Inheritance
All Implemented Interfaces
io.netty.util.ReferenceCounted, io.vertx.core.http.impl.ws.WebSocketFrameInternal, io.vertx.core.http.WebSocketFrame
Imports
io.netty.buffer.ByteBuf, .Unpooled, io.netty.util.CharsetUtil, .ReferenceCounted, io.vertx.core.buffer.Buffer, io.vertx.core.http.WebSocketFrame, .WebSocketFrameType, java.nio.charset.StandardCharsets

The default WebSocketFrameInternal implementation.
Authors
The Netty Project, Trustin Lee
Version
$Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $

Field Summary

Modifier and TypeField and Description
private ByteBuf
private boolean
private String
private short
private final boolean
private final WebSocketFrameType

Constructor Summary

AccessConstructor and Description
public
WebSocketFrameImpl()

Creates a new empty text frame.

public
WebSocketFrameImpl(WebSocketFrameType frameType)

Creates a new empty text frame.

public
WebSocketFrameImpl(String textData)

Creates a new text frame from with the specified string.

public
WebSocketFrameImpl(WebSocketFrameType type, byte[] utf8TextData, boolean isFinalFrame)

Creates a new raw frame from with the specified encoded content.

public
WebSocketFrameImpl(String textData, boolean isFinalFrame)

Creates a new text frame from with the specified string.

public
WebSocketFrameImpl(WebSocketFrameType
the type of the frame. 0 is the only allowed type currently.
type
,
ByteBuf
the content of the frame. If (type & 0x80 == 0), it must be encoded in UTF-8.
binaryData
)

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

public
WebSocketFrameImpl(WebSocketFrameType
the type of the frame. 0 is the only allowed type currently.
type
,
ByteBuf
the content of the frame. If (type & 0x80 == 0), it must be encoded in UTF-8.
binaryData
,
boolean
If this is the final frame in a sequence
isFinalFrame
)

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

Method Summary

Modifier and TypeMethod and Description
public Buffer
binaryData()

Implements io.vertx.core.http.WebSocketFrame.binaryData.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

public static WebSocketFrame
binaryFrame(Buffer
the data for the frame
data
,
boolean
true if it's the final frame in the WebSocket message
isFinal
)

Hides io.vertx.core.http.WebSocketFrame.binaryFrame.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Create a binary WebSocket frame.

private void
public String
public short
public static WebSocketFrame
continuationFrame(Buffer
the data for the frame
data
,
boolean
true if it's the final frame in the WebSocket message
isFinal
)

Hides io.vertx.core.http.WebSocketFrame.continuationFrame.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Create a continuation frame

public ByteBuf
getBinaryData()

Implements io.vertx.core.http.impl.ws.WebSocketFrameInternal.getBinaryData.

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

public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public int
private void
public static WebSocketFrame
pingFrame(Buffer
the bytes for the frame, may be at most 125 bytes
data
)

Hides io.vertx.core.http.WebSocketFrame.pingFrame.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Create a ping WebSocket frame.

public static WebSocketFrame
pongFrame(Buffer
the bytes for the frame, may be at most 125 bytes
data
)

Hides io.vertx.core.http.WebSocketFrame.pongFrame.

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Create a pong WebSocket frame.

public int
refCnt()

Implements io.netty.util.ReferenceCounted.refCnt.

Returns the reference count of this object.

public boolean
release()

Implements io.netty.util.ReferenceCounted.release.

Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0.

public boolean
release(int decrement)

Implements io.netty.util.ReferenceCounted.release.

Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0.

public ReferenceCounted
retain()

Implements io.netty.util.ReferenceCounted.retain.

Increases the reference count by 1.

public ReferenceCounted
retain(int increment)

Implements io.netty.util.ReferenceCounted.retain.

Increases the reference count by the specified increment.

public void
setBinaryData(ByteBuf
the content of the frame. If (type & 0x80 == 0), it must be encoded in UTF-8.
binaryData
)

Implements io.vertx.core.http.impl.ws.WebSocketFrameInternal.setBinaryData.

Sets the type and the content of this frame.

public void
setTextData(String
the content of the frame. Must be valid UTF-8
textData
)

Implements io.vertx.core.http.impl.ws.WebSocketFrameInternal.setTextData.

Set the type of the content of this frame and populate it with the given content

public String
public static WebSocketFrame
textFrame(String
the string for the frame
str
,
boolean
true if it's the final frame in the WebSocket message
isFinal
)

Hides io.vertx.core.http.WebSocketFrame.textFrame.

Create a text WebSocket frame.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public ReferenceCounted
touch()

Implements io.netty.util.ReferenceCounted.touch.

Records the current access location of this object for debugging purposes.

public ReferenceCounted
touch(Object hint)

Implements io.netty.util.ReferenceCounted.touch.

Records the current access location of this object with an additional arbitrary information for debugging purposes.

public WebSocketFrameType
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

binaryDataback to summary
private ByteBuf binaryData
closeParsedback to summary
private boolean closeParsed
closeReasonback to summary
private String closeReason
closeStatusCodeback to summary
private short closeStatusCode
isFinalFrameback to summary
private final boolean isFinalFrame
typeback to summary
private final WebSocketFrameType type

Constructor Detail

WebSocketFrameImplback to summary
public WebSocketFrameImpl()

Creates a new empty text frame.

WebSocketFrameImplback to summary
public WebSocketFrameImpl(WebSocketFrameType frameType)

Creates a new empty text frame.

WebSocketFrameImplback to summary
public WebSocketFrameImpl(String textData)

Creates a new text frame from with the specified string.

WebSocketFrameImplback to summary
public WebSocketFrameImpl(WebSocketFrameType type, byte[] utf8TextData, boolean isFinalFrame)

Creates a new raw frame from with the specified encoded content.

WebSocketFrameImplback to summary
public WebSocketFrameImpl(String textData, boolean isFinalFrame)

Creates a new text frame from with the specified string.

WebSocketFrameImplback to summary
public WebSocketFrameImpl(WebSocketFrameType type, ByteBuf binaryData)

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

Parameters
type:WebSocketFrameType

the type of the frame. 0 is the only allowed type currently.

binaryData:ByteBuf

the content of the frame. If (type & 0x80 == 0), it must be encoded in UTF-8.

Exceptions
IllegalArgumentException:
if If (type & 0x80 == 0) and the data is not encoded in UTF-8
WebSocketFrameImplback to summary
public WebSocketFrameImpl(WebSocketFrameType type, ByteBuf binaryData, boolean isFinalFrame)

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

Parameters
type:WebSocketFrameType

the type of the frame. 0 is the only allowed type currently.

binaryData:ByteBuf

the content of the frame. If (type & 0x80 == 0), it must be encoded in UTF-8.

isFinalFrame:boolean

If this is the final frame in a sequence

Exceptions
IllegalArgumentException:
if If (type & 0x80 == 0) and the data is not encoded in UTF-8

Method Detail

binaryDataback to summary
public Buffer binaryData()

Implements io.vertx.core.http.WebSocketFrame.binaryData.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Returns:Buffer

Doc from io.vertx.core.http.WebSocketFrame.binaryData.

the data of the frame

binaryFrameback to summary
public static WebSocketFrame binaryFrame(Buffer data, boolean isFinal)

Hides io.vertx.core.http.WebSocketFrame.binaryFrame.

Doc from io.vertx.core.http.WebSocketFrame.binaryFrame.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Create a binary WebSocket frame.

Parameters
data:Buffer

the data for the frame

isFinal:boolean

true if it's the final frame in the WebSocket message

Returns:WebSocketFrame

the frame

checkCloseback to summary
private void checkClose()
closeReasonback to summary
public String closeReason()

Implements io.vertx.core.http.WebSocketFrame.closeReason.

Returns:String

Doc from io.vertx.core.http.WebSocketFrame.closeReason.

string explaining close reason. Only use this for close frames

Annotations
@Override
closeStatusCodeback to summary
public short closeStatusCode()

Implements io.vertx.core.http.WebSocketFrame.closeStatusCode.

Returns:short

Doc from io.vertx.core.http.WebSocketFrame.closeStatusCode.

status code of close frame. Only use this for close frames

Annotations
@Override
continuationFrameback to summary
public static WebSocketFrame continuationFrame(Buffer data, boolean isFinal)

Hides io.vertx.core.http.WebSocketFrame.continuationFrame.

Doc from io.vertx.core.http.WebSocketFrame.continuationFrame.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Create a continuation frame

Parameters
data:Buffer

the data for the frame

isFinal:boolean

true if it's the final frame in the WebSocket message

Returns:WebSocketFrame

the frame

getBinaryDataback to summary
public ByteBuf getBinaryData()

Implements io.vertx.core.http.impl.ws.WebSocketFrameInternal.getBinaryData.

Doc from io.vertx.core.http.impl.ws.WebSocketFrameInternal.getBinaryData.

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

isBinaryback to summary
public boolean isBinary()

Implements io.vertx.core.http.WebSocketFrame.isBinary.

Returns:boolean

Doc from io.vertx.core.http.WebSocketFrame.isBinary.

whether the frame is a WebSocketFrameType#BINARY frame

isCloseback to summary
public boolean isClose()

Implements io.vertx.core.http.WebSocketFrame.isClose.

Returns:boolean

Doc from io.vertx.core.http.WebSocketFrame.isClose.

whether the frame is a WebSocketFrameType#CLOSE frame

isContinuationback to summary
public boolean isContinuation()

Implements io.vertx.core.http.WebSocketFrame.isContinuation.

Returns:boolean

Doc from io.vertx.core.http.WebSocketFrame.isContinuation.

whether the frame is a WebSocketFrameType#CONTINUATION frame

isFinalback to summary
public boolean isFinal()

Implements io.vertx.core.http.WebSocketFrame.isFinal.

Returns:boolean

Doc from io.vertx.core.http.WebSocketFrame.isFinal.

true if this is the final frame.

Annotations
@Override
isPingback to summary
public boolean isPing()

Implements io.vertx.core.http.WebSocketFrame.isPing.

Returns:boolean

Doc from io.vertx.core.http.WebSocketFrame.isPing.

whether the frame is a WebSocketFrameType#PING frame

Annotations
@Override
isTextback to summary
public boolean isText()

Implements io.vertx.core.http.WebSocketFrame.isText.

Returns:boolean

Doc from io.vertx.core.http.WebSocketFrame.isText.

whether the frame is a WebSocketFrameType#TEXT frame

lengthback to summary
public int length()

Implements io.vertx.core.http.impl.ws.WebSocketFrameInternal.length.

Returns:int

Doc from io.vertx.core.http.impl.ws.WebSocketFrameInternal.length.

the frame binary data length

Annotations
@Override
parseCloseFrameback to summary
private void parseCloseFrame()
pingFrameback to summary
public static WebSocketFrame pingFrame(Buffer data)

Hides io.vertx.core.http.WebSocketFrame.pingFrame.

Doc from io.vertx.core.http.WebSocketFrame.pingFrame.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Create a ping WebSocket frame. Will be a final frame. There is no option for non final ping frames.

Parameters
data:Buffer

the bytes for the frame, may be at most 125 bytes

Returns:WebSocketFrame

the frame

pongFrameback to summary
public static WebSocketFrame pongFrame(Buffer data)

Hides io.vertx.core.http.WebSocketFrame.pongFrame.

Doc from io.vertx.core.http.WebSocketFrame.pongFrame.

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Create a pong WebSocket frame. Will be a final frame. There is no option for non final pong frames.

Parameters
data:Buffer

the bytes for the frame, may be at most 125 bytes

Returns:WebSocketFrame

the frame

refCntback to summary
public int refCnt()

Implements io.netty.util.ReferenceCounted.refCnt.

Doc from io.netty.util.ReferenceCounted.refCnt.

Returns the reference count of this object. If 0, it means this object has been deallocated.

Annotations
@Override
releaseback to summary
public boolean release()

Implements io.netty.util.ReferenceCounted.release.

Doc from io.netty.util.ReferenceCounted.release.

Decreases the reference count by 1 and deallocates this object if the reference count reaches at 0.

Returns:boolean

true if and only if the reference count became 0 and this object has been deallocated

Annotations
@Override
releaseback to summary
public boolean release(int decrement)

Implements io.netty.util.ReferenceCounted.release.

Doc from io.netty.util.ReferenceCounted.release.

Decreases the reference count by the specified decrement and deallocates this object if the reference count reaches at 0.

Returns:boolean

true if and only if the reference count became 0 and this object has been deallocated

Annotations
@Override
retainback to summary
public ReferenceCounted retain()

Implements io.netty.util.ReferenceCounted.retain.

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

Increases the reference count by 1.

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

Implements io.netty.util.ReferenceCounted.retain.

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

Increases the reference count by the specified increment.

Annotations
@Override
setBinaryDataback to summary
public void setBinaryData(ByteBuf binaryData)

Implements io.vertx.core.http.impl.ws.WebSocketFrameInternal.setBinaryData.

Doc from io.vertx.core.http.impl.ws.WebSocketFrameInternal.setBinaryData.

Sets the type and the content of this frame.

Parameters
binaryData:ByteBuf

the content of the frame. If (type & 0x80 == 0), it must be encoded in UTF-8.

setTextDataback to summary
public void setTextData(String textData)

Implements io.vertx.core.http.impl.ws.WebSocketFrameInternal.setTextData.

Doc from io.vertx.core.http.impl.ws.WebSocketFrameInternal.setTextData.

Set the type of the content of this frame and populate it with the given content

Parameters
textData:String

the content of the frame. Must be valid UTF-8

textDataback to summary
public String textData()

Implements io.vertx.core.http.WebSocketFrame.textData.

Returns:String

Doc from io.vertx.core.http.WebSocketFrame.textData.

the content of this frame as a UTF-8 string and returns the converted string. Only use this for text frames.

textFrameback to summary
public static WebSocketFrame textFrame(String str, boolean isFinal)

Hides io.vertx.core.http.WebSocketFrame.textFrame.

Doc from io.vertx.core.http.WebSocketFrame.textFrame.

Create a text WebSocket frame.

Parameters
str:String

the string for the frame

isFinal:boolean

true if it's the final frame in the WebSocket message

Returns:WebSocketFrame

the frame

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
touchback to summary
public ReferenceCounted touch()

Implements io.netty.util.ReferenceCounted.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 ReferenceCounted touch(Object hint)

Implements io.netty.util.ReferenceCounted.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
typeback to summary
public WebSocketFrameType type()

Implements io.vertx.core.http.WebSocketFrame.type.

Returns:WebSocketFrameType

Doc from io.vertx.core.http.WebSocketFrame.type.

the frame type

Annotations
@Override