com.sun.grizzly.websockets
Class DataFrame
java.lang.Object
com.sun.grizzly.websockets.DataFrame
- Direct Known Subclasses:
- ClosingFrame
public class DataFrame
- extends Object
In memory representation of a websocket frame.
- See Also:
- Frame Definition
DataFrame
public DataFrame()
DataFrame
public DataFrame(FrameType type)
DataFrame
public DataFrame(String data)
DataFrame
public DataFrame(byte[] data)
DataFrame
public DataFrame(FrameType type,
byte[] bytes)
getType
public FrameType getType()
setType
public void setType(FrameType type)
getTextPayload
public String getTextPayload()
setPayload
public void setPayload(String payload)
setPayload
public void setPayload(byte[] bytes)
getBinaryPayload
public byte[] getBinaryPayload()
frame
public byte[] frame()
convert
public byte[] convert(long length)
- Converts the length given to the appropriate framing data:
- 0-125 one element that is the payload length.
- up to 0xFFFF, 3 element array starting with 126 with the following 2 bytes interpreted as
a 16 bit unsigned integer showing the payload length.
- else 9 element array starting with 127 with the following 8 bytes interpreted as a 64-bit
unsigned integer (the high bit must be 0) showing the payload length.
- Parameters:
length
- the payload size
- Returns:
- the array
toArray
public static byte[] toArray(long length)
convert
public static long convert(byte[] bytes,
int start,
int end)
convert
public static long convert(byte[] bytes)
- Convert a byte[] to a long. Used for rebuilding payload length.
respond
public void respond(WebSocket socket)
toString
public String toString()
- Overrides:
toString
in class Object
isLast
public boolean isLast()
setLast
public void setLast(boolean last)
Copyright © 2012 Oracle Corporation. All Rights Reserved.