|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.glassfish.grizzly.websockets.frame.Frame
public abstract class Frame
General abstraction, which represents WebSocket frame.
Contains a set of static createXXX methods in order to create specific frame.
| Field Summary | |
|---|---|
protected Buffer |
buffer
|
protected String |
text
|
protected int |
type
|
| Constructor Summary | |
|---|---|
protected |
Frame(int type,
Buffer buffer)
Construct a frame using the given type and binary data. |
| Method Summary | |
|---|---|
static Frame |
createCloseFrame()
Create the close frame, after sending which the WebSocket communication will be closed. |
static Frame |
createFrame(int type,
Buffer data)
Create a custom typed frame, which will contain a binary data. |
static Frame |
createFrame(int type,
String text)
Create a custom typed frame, which will contain a text, which will be encoded using UTF-8 charset. |
static Frame |
createFrame(int type,
String text,
Charset charset)
Create a custom typed frame, which will contain a text, which will be encoded using given charset. |
static Frame |
createTextFrame(String text)
Create the stream-based frame, which will contain UTF-8 string. |
Buffer |
getAsBinary()
Get the frame pyload as binary data. |
String |
getAsText()
Get the frame pyload as text using UTF-8 charset. |
String |
getAsText(Charset charset)
Get the frame pyload as text using given charset. |
int |
getType()
Get the frame type. |
abstract boolean |
isClose()
Returns true, if this frame is close frame, or false otherwise. |
abstract ParseResult |
parse(Buffer buffer)
Parses data from the Grizzly Buffer into this Frame |
abstract Buffer |
serialize()
Serializes this frame into a Grizzly Buffer. |
String |
toString()
Returns the frame pyload as text using UTF-8 charset. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int type
protected String text
protected Buffer buffer
| Constructor Detail |
|---|
protected Frame(int type,
Buffer buffer)
type - the frame type.buffer - the binary data.| Method Detail |
|---|
public static Frame createTextFrame(String text)
WebSockets.
text - the text.
Frame.public static Frame createCloseFrame()
WebSocket communication will be closed.
public static Frame createFrame(int type,
String text)
type - a frame type.text - text value.
public static Frame createFrame(int type,
String text,
Charset charset)
type - a frame type.text - text value.charset - text charset to use during the frame encoding.
public static Frame createFrame(int type,
Buffer data)
type - a frame type.data - binary data
public int getType()
public String getAsText()
public String getAsText(Charset charset)
charset - Charset to use.
public Buffer getAsBinary()
public String toString()
toString in class Objectpublic abstract boolean isClose()
public abstract Buffer serialize()
Buffer.
Buffer, which contains serialized Frame data.public abstract ParseResult parse(Buffer buffer)
Buffer into this Frame
ParseResult, which represents result of parsing operation.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||