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(WebSocketFrame frame) |
void |
configureFromExtensions(List<? extends Extension> exts) |
ByteBuffer |
generate(int windowSize,
WebSocketFrame frame)
Generate, into a ByteBuffer, no more than bufferSize of contents from the frame.
|
ByteBuffer |
generate(WebSocketFrame frame)
generate a byte buffer based on the frame being passed in
bufferSize is determined by the length of the payload + 28 for frame overhead
|
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(WebSocketFrame frame)
public ByteBuffer generate(int windowSize, WebSocketFrame frame)
generate(int, WebSocketFrame)
are required to obtain each window of ByteBuffer to complete the frame.public ByteBuffer generate(WebSocketFrame frame)
frame
- public boolean isRsv1InUse()
public boolean isRsv2InUse()
public boolean isRsv3InUse()
Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.