Top Description Inners Fields Constructors Methods
org.java_websocket.drafts

public Class Draft_6455

extends Draft
Class Inheritance
Imports
java.math.BigInteger, java.nio.ByteBuffer, java.security.MessageDigest, .NoSuchAlgorithmException, .SecureRandom, java.text.SimpleDateFormat, java.util.ArrayList, .Calendar, .Collections, .LinkedList, .List, .Locale, .TimeZone, org.java_websocket.WebSocketImpl, org.java_websocket.enums.CloseHandshakeType, .HandshakeState, .Opcode, .ReadyState, .Role, org.java_websocket.exceptions.IncompleteException, .InvalidDataException, .InvalidFrameException, .InvalidHandshakeException, .LimitExceededException, .NotSendableException, org.java_websocket.extensions.DefaultExtension, .IExtension, org.java_websocket.framing.BinaryFrame, .CloseFrame, .Framedata, .FramedataImpl1, .TextFrame, org.java_websocket.handshake.ClientHandshake, .ClientHandshakeBuilder, .HandshakeBuilder, .ServerHandshake, .ServerHandshakeBuilder, org.java_websocket.protocols.IProtocol, .Protocol, org.java_websocket.util.Base64, .Charsetfunctions, org.slf4j.Logger, .LoggerFactory

Implementation for the RFC 6455 websocket protocol This is the recommended class for your websocket connection

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private final List<ByteBuffer>
byteBufferList

Attribute for the payload of the current continuous frame

private static final String
CONNECTION

Handshake specific field for the connection

private Framedata
currentContinuousFrame

Attribute for the current continuous frame

private IExtension
currentDecodingExtension

Current active extension used to decode messages

private IExtension
defaultExtension

Attribute for the default extension

private ByteBuffer
incompleteframe

Attribute for the current incomplete frame

private List<IExtension>
knownExtensions

Attribute for all available extension in this draft

private List<IProtocol>
knownProtocols

Attribute for all available protocols in this draft

private final Logger
log

Logger instance

private int
maxFrameSize

Attribute for the maximum allowed size of a frame

private IExtension
negotiatedExtension

Attribute for the used extension in this draft

private IProtocol
protocol

Attribute for the used protocol in this draft

private final SecureRandom
reuseableRandom

Attribute for the reusable random instance

private static final String
SEC_WEB_SOCKET_ACCEPT

Handshake specific field for the accept

private static final String
SEC_WEB_SOCKET_EXTENSIONS

Handshake specific field for the extension

private static final String
SEC_WEB_SOCKET_KEY

Handshake specific field for the key

private static final String
SEC_WEB_SOCKET_PROTOCOL

Handshake specific field for the protocol

private static final String
UPGRADE

Handshake specific field for the upgrade

Inherited from org.java_websocket.drafts.Draft:
continuousFrameTyperole

Constructor Summary

AccessConstructor and Description
public
Draft_6455()

Constructor for the websocket protocol specified by RFC 6455 with default extensions

public
Draft_6455(IExtension
the extension which should be used for this draft
inputExtension
)

Constructor for the websocket protocol specified by RFC 6455 with custom extensions

public
Draft_6455(List<IExtension>
the extensions which should be used for this draft
inputExtensions
)

Constructor for the websocket protocol specified by RFC 6455 with custom extensions

public
Draft_6455(List<IExtension>
the extensions which should be used for this draft
inputExtensions
,
List<IProtocol>
the protocols which should be used for this draft
inputProtocols
)

Constructor for the websocket protocol specified by RFC 6455 with custom extensions and protocols

public
Draft_6455(List<IExtension>
the extensions which should be used for this draft
inputExtensions
,
int
the maximum allowed size of a frame (the real payload size, decoded frames can be bigger)
inputMaxFrameSize
)

Constructor for the websocket protocol specified by RFC 6455 with custom extensions and protocols

public
Draft_6455(List<IExtension>
the extensions which should be used for this draft
inputExtensions
,
List<IProtocol>
the protocols which should be used for this draft
inputProtocols
,
int
the maximum allowed size of a frame (the real payload size, decoded frames can be bigger)
inputMaxFrameSize
)

Constructor for the websocket protocol specified by RFC 6455 with custom extensions and protocols

Method Summary

Modifier and TypeMethod and Description
public HandshakeState
public HandshakeState
private void
addToBufferList(ByteBuffer
the new payload
payloadData
)

Add a payload to the current bytebuffer list

private void
checkBufferLimit()

Check the current size of the buffer and throw an exception if the size is bigger than the max allowed frame size

private void
clearBufferList()

Clear the current bytebuffer list

private HandshakeState

Returns:

MATCHED if it is matched, otherwise NOT_MATCHED
containsRequestedProtocol
(String
the requested protocol
requestedProtocol
)

Check if the requested protocol is part of this draft

public Draft
copyInstance()

Implements abstract org.java_websocket.drafts.Draft.copyInstance.

Drafts must only be by one websocket at all.

public ByteBuffer
private ByteBuffer
public List<Framedata>
createFrames(ByteBuffer binary, boolean mask)

Implements abstract org.java_websocket.drafts.Draft.createFrames.

public List<Framedata>
createFrames(String text, boolean mask)

Implements abstract org.java_websocket.drafts.Draft.createFrames.

public boolean
equals(Object o)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

private byte
private String

Returns:

a final key
generateFinalKey
(String
the input string
in
)

Generate a final key from a input string

private long

Returns:

the size as long (to not get an integer overflow)
getByteBufferListSize
()

Get the current size of the resulting bytebuffer in the bytebuffer list

public CloseHandshakeType
public IExtension

Returns:

the extension which is used or null, if handshake is not yet done
getExtension
()

Getter for the extension which is used by this draft

public List<IExtension>

Returns:

the extensions which are enabled for this draft
getKnownExtensions
()

Getter for all available extensions for this draft

public List<IProtocol>

Returns:

the protocols which are enabled for this draft
getKnownProtocols
()

Getter for all available protocols for this draft

private byte

Returns:

-128 for true, 0 for false
getMaskByte
(boolean
is mask active or not
mask
)

Get the mask byte if existing

public int

Returns:

the size, which is allowed for the payload
getMaxFrameSize
()

Getter for the maximum allowed payload size which is used by this draft

private ByteBuffer

Returns:

a bytebuffer containing all the data
getPayloadFromByteBufferList
()

Method to generate a full bytebuffer out of all the fragmented frame payload

public IProtocol

Returns:

the protocol which is used or null, if handshake is not yet done or no valid protocols
getProtocol
()

Getter for the protocol which is used by this draft

private byte

Returns:

byte that represents which RSV bit is set.
getRSVByte
(int
Can only be {0, 1, 2, 3}
rsv
)

Get a byte that can set RSV bits when OR(|)'d.

private String

Returns:

the server time
getServerTime
()

Generate a date for for the date-header

private int

Returns:

the size bytes
getSizeBytes
(ByteBuffer
the current buffer
mes
)

Get the size bytes for the byte buffer

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

private void
logRuntimeException(WebSocketImpl
the implementation of the websocket
webSocketImpl
,
RuntimeException
the runtime exception
e
)

Log the runtime exception to the specific WebSocketImpl

public ClientHandshakeBuilder
public HandshakeBuilder
public void
processFrame(WebSocketImpl webSocketImpl, Framedata frame)

Implements abstract org.java_websocket.drafts.Draft.processFrame.

Handle the frame specific to the draft

private void
processFrameBinary(WebSocketImpl
the websocket impl
webSocketImpl
,
Framedata
the frame
frame
)

Process the frame if it is a binary frame

private void
processFrameClosing(WebSocketImpl
the websocket impl
webSocketImpl
,
Framedata
the frame
frame
)

Process the frame if it is a closing frame

private void
processFrameContinuousAndNonFin(WebSocketImpl
the websocket implementation to use
webSocketImpl
,
Framedata
the current frame
frame
,
Opcode
the current Opcode
curop
)

Process the frame if it is a continuous frame or the fin bit is not set

private void
processFrameIsFin(WebSocketImpl
the websocket impl
webSocketImpl
,
Framedata
the frame
frame
)

Process the frame if it is the last frame

private void
processFrameIsNotFin(Framedata
the frame
frame
)

Process the frame if it is not the last frame

private void
processFrameText(WebSocketImpl
the websocket impl
webSocketImpl
,
Framedata
the frame
frame
)

Process the frame if it is a text frame

public void
private byte[]
toByteArray(long val, int bytecount)

private Opcode
toOpcode(byte opcode)

public String
toString()

Overrides org.java_websocket.drafts.Draft.toString.

Returns a string representation of the object.

public List<Framedata>
private Framedata
private void
translateSingleFrameCheckLengthLimit(long
the current payload length
length
)

Check if the frame size exceeds the allowed limit

private void
translateSingleFrameCheckPacketSize(int
the max packet size
maxpacketsize
,
int
the real packet size
realpacketsize
)

Check if the max packet size is smaller than the real packet size

private Draft_6455.TranslatedPayloadMetaData

Returns:

the new payload data containing new payload length and new packet size
translateSingleFramePayloadLength
(ByteBuffer
the buffer to read from
buffer
,
Opcode
the decoded optcode
optcode
,
int
the old payload length
oldPayloadlength
,
int
the max packet size allowed
maxpacketsize
,
int
the real packet size
oldRealpacketsize
)

Translate the buffer depending when it has an extended payload length (126 or 127)

Inherited from org.java_websocket.drafts.Draft:
basicAcceptcheckAlloccontinuousFramecreateHandshakecreateHandshakecreateHandshakecreateHandshakegetRolereadLinereadStringLinereadVersionsetParseModetranslateHandshaketranslateHandshakeHttp

Field Detail

byteBufferListback to summary
private final List<ByteBuffer> byteBufferList

Attribute for the payload of the current continuous frame

CONNECTIONback to summary
private static final String CONNECTION

Handshake specific field for the connection

currentContinuousFrameback to summary
private Framedata currentContinuousFrame

Attribute for the current continuous frame

currentDecodingExtensionback to summary
private IExtension currentDecodingExtension

Current active extension used to decode messages

defaultExtensionback to summary
private IExtension defaultExtension

Attribute for the default extension

incompleteframeback to summary
private ByteBuffer incompleteframe

Attribute for the current incomplete frame

knownExtensionsback to summary
private List<IExtension> knownExtensions

Attribute for all available extension in this draft

knownProtocolsback to summary
private List<IProtocol> knownProtocols

Attribute for all available protocols in this draft

logback to summary
private final Logger log

Logger instance

Since
1.4.0
maxFrameSizeback to summary
private int maxFrameSize

Attribute for the maximum allowed size of a frame

Since
1.4.0
negotiatedExtensionback to summary
private IExtension negotiatedExtension

Attribute for the used extension in this draft

protocolback to summary
private IProtocol protocol

Attribute for the used protocol in this draft

reuseableRandomback to summary
private final SecureRandom reuseableRandom

Attribute for the reusable random instance

SEC_WEB_SOCKET_ACCEPTback to summary
private static final String SEC_WEB_SOCKET_ACCEPT

Handshake specific field for the accept

SEC_WEB_SOCKET_EXTENSIONSback to summary
private static final String SEC_WEB_SOCKET_EXTENSIONS

Handshake specific field for the extension

SEC_WEB_SOCKET_KEYback to summary
private static final String SEC_WEB_SOCKET_KEY

Handshake specific field for the key

SEC_WEB_SOCKET_PROTOCOLback to summary
private static final String SEC_WEB_SOCKET_PROTOCOL

Handshake specific field for the protocol

UPGRADEback to summary
private static final String UPGRADE

Handshake specific field for the upgrade

Constructor Detail

Draft_6455back to summary
public Draft_6455()

Constructor for the websocket protocol specified by RFC 6455 with default extensions

Since
1.3.5
Draft_6455back to summary
public Draft_6455(IExtension inputExtension)

Constructor for the websocket protocol specified by RFC 6455 with custom extensions

Parameters
inputExtension:IExtension

the extension which should be used for this draft

Since
1.3.5
Draft_6455back to summary
public Draft_6455(List<IExtension> inputExtensions)

Constructor for the websocket protocol specified by RFC 6455 with custom extensions

Parameters
inputExtensions:List<IExtension>

the extensions which should be used for this draft

Since
1.3.5
Draft_6455back to summary
public Draft_6455(List<IExtension> inputExtensions, List<IProtocol> inputProtocols)

Constructor for the websocket protocol specified by RFC 6455 with custom extensions and protocols

Parameters
inputExtensions:List<IExtension>

the extensions which should be used for this draft

inputProtocols:List<IProtocol>

the protocols which should be used for this draft

Since
1.3.7
Draft_6455back to summary
public Draft_6455(List<IExtension> inputExtensions, int inputMaxFrameSize)

Constructor for the websocket protocol specified by RFC 6455 with custom extensions and protocols

Parameters
inputExtensions:List<IExtension>

the extensions which should be used for this draft

inputMaxFrameSize:int

the maximum allowed size of a frame (the real payload size, decoded frames can be bigger)

Since
1.4.0
Draft_6455back to summary
public Draft_6455(List<IExtension> inputExtensions, List<IProtocol> inputProtocols, int inputMaxFrameSize)

Constructor for the websocket protocol specified by RFC 6455 with custom extensions and protocols

Parameters
inputExtensions:List<IExtension>

the extensions which should be used for this draft

inputProtocols:List<IProtocol>

the protocols which should be used for this draft

inputMaxFrameSize:int

the maximum allowed size of a frame (the real payload size, decoded frames can be bigger)

Since
1.4.0

Method Detail

acceptHandshakeAsClientback to summary
public HandshakeState acceptHandshakeAsClient(ClientHandshake request, ServerHandshake response) throws InvalidHandshakeException

Implements abstract org.java_websocket.drafts.Draft.acceptHandshakeAsClient.

Annotations
@Override
acceptHandshakeAsServerback to summary
public HandshakeState acceptHandshakeAsServer(ClientHandshake handshakedata) throws InvalidHandshakeException

Implements abstract org.java_websocket.drafts.Draft.acceptHandshakeAsServer.

Annotations
@Override
addToBufferListback to summary
private void addToBufferList(ByteBuffer payloadData)

Add a payload to the current bytebuffer list

Parameters
payloadData:ByteBuffer

the new payload

checkBufferLimitback to summary
private void checkBufferLimit() throws LimitExceededException

Check the current size of the buffer and throw an exception if the size is bigger than the max allowed frame size

Exceptions
LimitExceededException:
if the current size is bigger than the allowed size
clearBufferListback to summary
private void clearBufferList()

Clear the current bytebuffer list

containsRequestedProtocolback to summary
private HandshakeState containsRequestedProtocol(String requestedProtocol)

Check if the requested protocol is part of this draft

Parameters
requestedProtocol:String

the requested protocol

Returns:HandshakeState

MATCHED if it is matched, otherwise NOT_MATCHED

copyInstanceback to summary
public Draft copyInstance()

Implements abstract org.java_websocket.drafts.Draft.copyInstance.

Doc from org.java_websocket.drafts.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.

Annotations
@Override
createBinaryFrameback to summary
public ByteBuffer createBinaryFrame(Framedata framedata)

Implements abstract org.java_websocket.drafts.Draft.createBinaryFrame.

Annotations
@Override
createByteBufferFromFramedataback to summary
private ByteBuffer createByteBufferFromFramedata(Framedata framedata)
createFramesback to summary
public List<Framedata> createFrames(ByteBuffer binary, boolean mask)

Implements abstract org.java_websocket.drafts.Draft.createFrames.

Annotations
@Override
createFramesback to summary
public List<Framedata> createFrames(String text, boolean mask)

Implements abstract org.java_websocket.drafts.Draft.createFrames.

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
fromOpcodeback to summary
private byte fromOpcode(Opcode opcode)
generateFinalKeyback to summary
private String generateFinalKey(String in)

Generate a final key from a input string

Parameters
in:String

the input string

Returns:String

a final key

getByteBufferListSizeback to summary
private long getByteBufferListSize()

Get the current size of the resulting bytebuffer in the bytebuffer list

Returns:long

the size as long (to not get an integer overflow)

getCloseHandshakeTypeback to summary
public CloseHandshakeType getCloseHandshakeType()

Implements abstract org.java_websocket.drafts.Draft.getCloseHandshakeType.

Annotations
@Override
getExtensionback to summary
public IExtension getExtension()

Getter for the extension which is used by this draft

Returns:IExtension

the extension which is used or null, if handshake is not yet done

getKnownExtensionsback to summary
public List<IExtension> getKnownExtensions()

Getter for all available extensions for this draft

Returns:List<IExtension>

the extensions which are enabled for this draft

getKnownProtocolsback to summary
public List<IProtocol> getKnownProtocols()

Getter for all available protocols for this draft

Returns:List<IProtocol>

the protocols which are enabled for this draft

Since
1.3.7
getMaskByteback to summary
private byte getMaskByte(boolean mask)

Get the mask byte if existing

Parameters
mask:boolean

is mask active or not

Returns:byte

-128 for true, 0 for false

getMaxFrameSizeback to summary
public int getMaxFrameSize()

Getter for the maximum allowed payload size which is used by this draft

Returns:int

the size, which is allowed for the payload

Since
1.4.0
getPayloadFromByteBufferListback to summary
private ByteBuffer getPayloadFromByteBufferList() throws LimitExceededException

Method to generate a full bytebuffer out of all the fragmented frame payload

Returns:ByteBuffer

a bytebuffer containing all the data

Exceptions
LimitExceededException:
will be thrown when the totalSize is bigger then Integer.MAX_VALUE due to not being able to allocate more
getProtocolback to summary
public IProtocol getProtocol()

Getter for the protocol which is used by this draft

Returns:IProtocol

the protocol which is used or null, if handshake is not yet done or no valid protocols

Since
1.3.7
getRSVByteback to summary
private byte getRSVByte(int rsv)

Get a byte that can set RSV bits when OR(|)'d. 0 1 2 3 4 5 6 7 +-+-+-+-+-------+ |F|R|R|R| opcode| |I|S|S|S| (4) | |N|V|V|V| | | |1|2|3| |

Parameters
rsv:int

Can only be {0, 1, 2, 3}

Returns:byte

byte that represents which RSV bit is set.

getServerTimeback to summary
private String getServerTime()

Generate a date for for the date-header

Returns:String

the server time

getSizeBytesback to summary
private int getSizeBytes(ByteBuffer mes)

Get the size bytes for the byte buffer

Parameters
mes:ByteBuffer

the current buffer

Returns:int

the size bytes

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Annotations
@Override
logRuntimeExceptionback to summary
private void logRuntimeException(WebSocketImpl webSocketImpl, RuntimeException e)

Log the runtime exception to the specific WebSocketImpl

Parameters
webSocketImpl:WebSocketImpl

the implementation of the websocket

e:RuntimeException

the runtime exception

postProcessHandshakeRequestAsClientback to summary
public ClientHandshakeBuilder postProcessHandshakeRequestAsClient(ClientHandshakeBuilder request)

Implements abstract org.java_websocket.drafts.Draft.postProcessHandshakeRequestAsClient.

Annotations
@Override
postProcessHandshakeResponseAsServerback to summary
public HandshakeBuilder postProcessHandshakeResponseAsServer(ClientHandshake request, ServerHandshakeBuilder response) throws InvalidHandshakeException

Implements abstract org.java_websocket.drafts.Draft.postProcessHandshakeResponseAsServer.

Annotations
@Override
processFrameback to summary
public void processFrame(WebSocketImpl webSocketImpl, Framedata frame) throws InvalidDataException

Implements abstract org.java_websocket.drafts.Draft.processFrame.

Doc from org.java_websocket.drafts.Draft.processFrame.

Handle the frame specific to the draft

Annotations
@Override
Exceptions
InvalidDataException:
will be thrown on invalid data
processFrameBinaryback to summary
private void processFrameBinary(WebSocketImpl webSocketImpl, Framedata frame)

Process the frame if it is a binary frame

Parameters
webSocketImpl:WebSocketImpl

the websocket impl

frame:Framedata

the frame

processFrameClosingback to summary
private void processFrameClosing(WebSocketImpl webSocketImpl, Framedata frame)

Process the frame if it is a closing frame

Parameters
webSocketImpl:WebSocketImpl

the websocket impl

frame:Framedata

the frame

processFrameContinuousAndNonFinback to summary
private void processFrameContinuousAndNonFin(WebSocketImpl webSocketImpl, Framedata frame, Opcode curop) throws InvalidDataException

Process the frame if it is a continuous frame or the fin bit is not set

Parameters
webSocketImpl:WebSocketImpl

the websocket implementation to use

frame:Framedata

the current frame

curop:Opcode

the current Opcode

Exceptions
InvalidDataException:
if there is a protocol error
processFrameIsFinback to summary
private void processFrameIsFin(WebSocketImpl webSocketImpl, Framedata frame) throws InvalidDataException

Process the frame if it is the last frame

Parameters
webSocketImpl:WebSocketImpl

the websocket impl

frame:Framedata

the frame

Exceptions
InvalidDataException:
if there is a protocol error
processFrameIsNotFinback to summary
private void processFrameIsNotFin(Framedata frame) throws InvalidDataException

Process the frame if it is not the last frame

Parameters
frame:Framedata

the frame

Exceptions
InvalidDataException:
if there is a protocol error
processFrameTextback to summary
private void processFrameText(WebSocketImpl webSocketImpl, Framedata frame) throws InvalidDataException

Process the frame if it is a text frame

Parameters
webSocketImpl:WebSocketImpl

the websocket impl

frame:Framedata

the frame

resetback to summary
public void reset()

Implements abstract org.java_websocket.drafts.Draft.reset.

Annotations
@Override
toByteArrayback to summary
private byte[] toByteArray(long val, int bytecount)
toOpcodeback to summary
private Opcode toOpcode(byte opcode) throws InvalidFrameException
toStringback to summary
public String toString()

Overrides org.java_websocket.drafts.Draft.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
translateFrameback to summary
public List<Framedata> translateFrame(ByteBuffer buffer) throws InvalidDataException

Implements abstract org.java_websocket.drafts.Draft.translateFrame.

Annotations
@Override
translateSingleFrameback to summary
private Framedata translateSingleFrame(ByteBuffer buffer) throws IncompleteException, InvalidDataException
translateSingleFrameCheckLengthLimitback to summary
private void translateSingleFrameCheckLengthLimit(long length) throws LimitExceededException

Check if the frame size exceeds the allowed limit

Parameters
length:long

the current payload length

Exceptions
LimitExceededException:
if the payload length is to big
translateSingleFrameCheckPacketSizeback to summary
private void translateSingleFrameCheckPacketSize(int maxpacketsize, int realpacketsize) throws IncompleteException

Check if the max packet size is smaller than the real packet size

Parameters
maxpacketsize:int

the max packet size

realpacketsize:int

the real packet size

Exceptions
IncompleteException:
if the maxpacketsize is smaller than the realpackagesize
translateSingleFramePayloadLengthback to summary
private Draft_6455.TranslatedPayloadMetaData translateSingleFramePayloadLength(ByteBuffer buffer, Opcode optcode, int oldPayloadlength, int maxpacketsize, int oldRealpacketsize) throws InvalidFrameException, IncompleteException, LimitExceededException

Translate the buffer depending when it has an extended payload length (126 or 127)

Parameters
buffer:ByteBuffer

the buffer to read from

optcode:Opcode

the decoded optcode

oldPayloadlength:int

the old payload length

maxpacketsize:int

the max packet size allowed

oldRealpacketsize:int

the real packet size

Returns:Draft_6455.TranslatedPayloadMetaData

the new payload data containing new payload length and new packet size

Exceptions
InvalidFrameException:
thrown if a control frame has an invalid length
IncompleteException:
if the maxpacketsize is smaller than the realpackagesize
LimitExceededException:
if the payload length is to big
org.java_websocket.drafts back to summary

private Class Draft_6455.TranslatedPayloadMetaData

extends Object
Class Inheritance
  • java.lang.Object
  • org.java_websocket.drafts.Draft_6455.TranslatedPayloadMetaData

Field Summary

Modifier and TypeField and Description
private int
private int

Constructor Summary

AccessConstructor and Description
pack-priv
TranslatedPayloadMetaData(int newPayloadLength, int newRealPackageSize)

Method Summary

Modifier and TypeMethod and Description
private int
private int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

payloadLengthback to summary
private int payloadLength
realPackageSizeback to summary
private int realPackageSize

Constructor Detail

TranslatedPayloadMetaDataback to summary
pack-priv TranslatedPayloadMetaData(int newPayloadLength, int newRealPackageSize)

Method Detail

getPayloadLengthback to summary
private int getPayloadLength()
getRealPackageSizeback to summary
private int getRealPackageSize()