Package org.java_websocket.drafts
Class Draft
- java.lang.Object
- 
- org.java_websocket.drafts.Draft
 
- 
- Direct Known Subclasses:
- Draft_6455
 
 public abstract class Draft extends Object Base class for everything of a websocket specification which is not common such as the way the handshake is read or frames are transfered.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classDraft.CloseHandshakeTypeEnum which represents type of handshake is required for a closestatic classDraft.HandshakeStateEnum which represents the states a handshake may be in
 - 
Field SummaryFields Modifier and Type Field Description protected Framedata.OpcodecontinuousFrameTypestatic intINITIAL_FAMESIZEstatic intMAX_FAME_SIZEprotected WebSocket.RoleroleIn some cases the handshake will be parsed different depending on whether
 - 
Constructor SummaryConstructors Constructor Description Draft()
 - 
Method Summary
 
- 
- 
- 
Field Detail- 
MAX_FAME_SIZEpublic static int MAX_FAME_SIZE 
 - 
INITIAL_FAMESIZEpublic static int INITIAL_FAMESIZE 
 - 
roleprotected WebSocket.Role role In some cases the handshake will be parsed different depending on whether
 - 
continuousFrameTypeprotected Framedata.Opcode continuousFrameType 
 
- 
 - 
Method Detail- 
readLinepublic static ByteBuffer readLine(ByteBuffer buf) 
 - 
readStringLinepublic static String readStringLine(ByteBuffer buf) 
 - 
translateHandshakeHttppublic static HandshakeBuilder translateHandshakeHttp(ByteBuffer buf, WebSocket.Role role) throws InvalidHandshakeException, IncompleteHandshakeException 
 - 
acceptHandshakeAsClientpublic abstract Draft.HandshakeState acceptHandshakeAsClient(ClientHandshake request, ServerHandshake response) throws InvalidHandshakeException - Throws:
- InvalidHandshakeException
 
 - 
acceptHandshakeAsServerpublic abstract Draft.HandshakeState acceptHandshakeAsServer(ClientHandshake handshakedata) throws InvalidHandshakeException - Throws:
- InvalidHandshakeException
 
 - 
basicAcceptprotected boolean basicAccept(Handshakedata handshakedata) 
 - 
createBinaryFramepublic abstract ByteBuffer createBinaryFrame(Framedata framedata) 
 - 
createFramespublic abstract List<Framedata> createFrames(ByteBuffer binary, boolean mask) 
 - 
processFramepublic abstract void processFrame(WebSocketImpl webSocketImpl, Framedata frame) throws InvalidDataException Handle the frame specific to the draft- Parameters:
- webSocketImpl- the websocketimpl used for this draft
- frame- the frame which is supposed to be handled
- Throws:
- InvalidDataException- will be thrown on invalid data
 
 - 
continuousFramepublic List<Framedata> continuousFrame(Framedata.Opcode op, ByteBuffer buffer, boolean fin) 
 - 
resetpublic abstract void reset() 
 - 
createHandshakepublic List<ByteBuffer> createHandshake(Handshakedata handshakedata, WebSocket.Role ownrole) 
 - 
createHandshakepublic List<ByteBuffer> createHandshake(Handshakedata handshakedata, WebSocket.Role ownrole, boolean withcontent) 
 - 
postProcessHandshakeRequestAsClientpublic abstract ClientHandshakeBuilder postProcessHandshakeRequestAsClient(ClientHandshakeBuilder request) throws InvalidHandshakeException - Throws:
- InvalidHandshakeException
 
 - 
postProcessHandshakeResponseAsServerpublic abstract HandshakeBuilder postProcessHandshakeResponseAsServer(ClientHandshake request, ServerHandshakeBuilder response) throws InvalidHandshakeException - Throws:
- InvalidHandshakeException
 
 - 
translateFramepublic abstract List<Framedata> translateFrame(ByteBuffer buffer) throws InvalidDataException - Throws:
- InvalidDataException
 
 - 
getCloseHandshakeTypepublic abstract Draft.CloseHandshakeType getCloseHandshakeType() 
 - 
copyInstancepublic abstract Draft copyInstance() Drafts must only be by one websocket at all. To prevent drafts to be used more than once the Websocket implementation should call this method in order to create a new usable version of a given draft instance.
 The copy can be safely used in conjunction with a new websocket connection.- Returns:
- a copy of the draft
 
 - 
translateHandshakepublic Handshakedata translateHandshake(ByteBuffer buf) throws InvalidHandshakeException - Throws:
- InvalidHandshakeException
 
 - 
checkAllocpublic int checkAlloc(int bytecount) throws LimitExedeedException, InvalidDataException
 - 
setParseModepublic void setParseMode(WebSocket.Role role) 
 - 
getRolepublic WebSocket.Role getRole() 
 
- 
 
-