Top Description Inners Fields Constructors Methods
org.eclipse.jetty.websocket.core.internal

public Class Parser

extends Object
Class Inheritance
Imports
java.nio.ByteBuffer, org.eclipse.jetty.io.ByteBufferPool, .RetainableByteBuffer, org.eclipse.jetty.util.BufferUtil, .StringUtil, org.eclipse.jetty.websocket.core.Configuration, .Frame, .OpCode, org.eclipse.jetty.websocket.core.exception.MessageTooLargeException, .ProtocolException, .WebSocketException, org.slf4j.Logger, .LoggerFactory

Parsing of a frames in WebSocket land.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private RetainableByteBuffer
private final ByteBufferPool
private final Configuration
private int
private byte
private static final Logger
private byte[]
private int
private Parser.State

Constructor Summary

AccessConstructor and Description
public
Parser(ByteBufferPool bufferPool)

public
Parser(ByteBufferPool bufferPool, Configuration configuration)

Method Summary

Modifier and TypeMethod and Description
private Frame.Parsed
autoFragment(ByteBuffer buffer, int fragmentSize)

protected void
checkFrameSize(byte opcode, int payloadLength)

public int
protected Frame.Parsed
newFrame(byte firstByte, byte[] mask, ByteBuffer payload, Runnable releaser)

public Frame.Parsed

Returns:

Frame or null if not enough data for a complete frame.
parse
(ByteBuffer
the buffer to parse from.
buffer
)

Parse the buffer.

private Frame.Parsed
public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

aggregateback to summary
private RetainableByteBuffer aggregate
bufferPoolback to summary
private final ByteBufferPool bufferPool
configurationback to summary
private final Configuration configuration
cursorback to summary
private int cursor
firstByteback to summary
private byte firstByte
LOGback to summary
private static final Logger LOG
maskback to summary
private byte[] mask
payloadLengthback to summary
private int payloadLength
stateback to summary
private Parser.State state

Constructor Detail

Parserback to summary
public Parser(ByteBufferPool bufferPool)
Parserback to summary
public Parser(ByteBufferPool bufferPool, Configuration configuration)

Method Detail

autoFragmentback to summary
private Frame.Parsed autoFragment(ByteBuffer buffer, int fragmentSize)
checkFrameSizeback to summary
protected void checkFrameSize(byte opcode, int payloadLength) throws MessageTooLargeException, ProtocolException
getPayloadLengthback to summary
public int getPayloadLength()
newFrameback to summary
protected Frame.Parsed newFrame(byte firstByte, byte[] mask, ByteBuffer payload, Runnable releaser)
parseback to summary
public Frame.Parsed parse(ByteBuffer buffer) throws WebSocketException

Parse the buffer.

Parameters
buffer:ByteBuffer

the buffer to parse from.

Returns:Frame.Parsed

Frame or null if not enough data for a complete frame.

Exceptions
WebSocketException:
if unable to parse properly
parsePayloadback to summary
private Frame.Parsed parsePayload(ByteBuffer buffer)
resetback to summary
public void reset()
toStringback to summary
public String toString()

Overrides java.lang.Object.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.

Returns:String

a string representation of the object

Annotations
@Override
org.eclipse.jetty.websocket.core.internal back to summary

private final Enum Parser.State

extends Enum<Parser.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final Parser.State
public static final Parser.State
public static final Parser.State
public static final Parser.State
public static final Parser.State
public static final Parser.State
public static final Parser.State

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Parser.State
public static Parser.State[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

FRAGMENTback to summary
public static final Parser.State FRAGMENT
MASKback to summary
public static final Parser.State MASK
MASK_BYTESback to summary
public static final Parser.State MASK_BYTES
PAYLOADback to summary
public static final Parser.State PAYLOAD
PAYLOAD_LENback to summary
public static final Parser.State PAYLOAD_LEN
PAYLOAD_LEN_BYTESback to summary
public static final Parser.State PAYLOAD_LEN_BYTES
STARTback to summary
public static final Parser.State START

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static Parser.State valueOf(String name)
valuesback to summary
public static Parser.State[] values()