public class Generator extends Object
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-------+-+-------------+-------------------------------+
|F|R|R|R| opcode|M| Payload len | Extended payload length |
|I|S|S|S| (4) |A| (7) | (16/64) |
|N|V|V|V| |S| | (if payload len==126/127) |
| |1|2|3| |K| | |
+-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
| Extended payload length continued, if payload len == 127 |
+ - - - - - - - - - - - - - - - +-------------------------------+
| |Masking-key, if MASK set to 1 |
+-------------------------------+-------------------------------+
| Masking-key (continued) | Payload Data |
+-------------------------------- - - - - - - - - - - - - - - - +
: Payload Data continued ... :
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Payload Data continued ... |
+---------------------------------------------------------------+
| Modifier and Type | Field and Description |
|---|---|
static int |
OVERHEAD
The overhead (maximum) for a framing header.
|
| Constructor and Description |
|---|
Generator(WebSocketPolicy policy,
ByteBufferPool bufferPool)
Construct Generator with provided policy and bufferPool
|
Generator(WebSocketPolicy policy,
ByteBufferPool bufferPool,
boolean validating)
Construct Generator with provided policy and bufferPool
|
| Modifier and Type | Method and Description |
|---|---|
void |
assertFrameValid(Frame frame) |
void |
configureFromExtensions(List<? extends Extension> exts) |
ByteBuffer |
generateHeaderBytes(Frame frame) |
void |
generateWholeFrame(Frame frame,
ByteBuffer buf)
Generate the whole frame (header + payload copy) into a single ByteBuffer.
|
ByteBufferPool |
getBufferPool() |
ByteBuffer |
getPayloadWindow(int windowSize,
Frame frame) |
boolean |
isRsv1InUse() |
boolean |
isRsv2InUse() |
boolean |
isRsv3InUse() |
String |
toString() |
public static final int OVERHEAD
public Generator(WebSocketPolicy policy, ByteBufferPool bufferPool)
policy - the policy to usebufferPool - the buffer pool to usepublic Generator(WebSocketPolicy policy, ByteBufferPool bufferPool, boolean validating)
policy - the policy to usebufferPool - the buffer pool to usevalidating - true to enable RFC frame validationpublic void assertFrameValid(Frame frame)
public ByteBuffer generateHeaderBytes(Frame frame)
public void generateWholeFrame(Frame frame, ByteBuffer buf)
Note: THIS IS SLOW. Only use this if you must.
frame - the frame to generatepublic ByteBufferPool getBufferPool()
public ByteBuffer getPayloadWindow(int windowSize, Frame frame)
public boolean isRsv1InUse()
public boolean isRsv2InUse()
public boolean isRsv3InUse()
Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.