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 |
MAX_HEADER_LENGTH
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 |
generateHeaderBytes(Frame frame,
ByteBuffer buffer) |
void |
generateWholeFrame(Frame frame,
ByteBuffer buf)
Generate the whole frame (header + payload copy) into a single ByteBuffer.
|
ByteBufferPool |
getBufferPool() |
boolean |
isRsv1InUse() |
boolean |
isRsv2InUse() |
boolean |
isRsv3InUse() |
void |
setRsv1InUse(boolean rsv1InUse) |
void |
setRsv2InUse(boolean rsv2InUse) |
void |
setRsv3InUse(boolean rsv3InUse) |
String |
toString() |
public static final int MAX_HEADER_LENGTH
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 generateHeaderBytes(Frame frame, ByteBuffer buffer)
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 void setRsv1InUse(boolean rsv1InUse)
public void setRsv2InUse(boolean rsv2InUse)
public void setRsv3InUse(boolean rsv3InUse)
public boolean isRsv1InUse()
public boolean isRsv2InUse()
public boolean isRsv3InUse()
Copyright © 1995-2014 Mort Bay Consulting. All Rights Reserved.