Class Parser


  • public class Parser
    extends java.lang.Object
    Parsing of a frames in WebSocket land.
    • Field Detail

      • LOG

        private static final org.eclipse.jetty.util.log.Logger LOG
      • bufferPool

        private final org.eclipse.jetty.io.ByteBufferPool bufferPool
      • messagesIn

        private final java.util.concurrent.atomic.LongAdder messagesIn
      • cursor

        private int cursor
      • priorDataFrame

        private boolean priorDataFrame
      • payload

        private java.nio.ByteBuffer payload
      • payloadLength

        private int payloadLength
      • flagsInUse

        private byte flagsInUse
        Is there an extension using RSV flag?

           0100_0000 (0x40) = rsv1
           0010_0000 (0x20) = rsv2
           0001_0000 (0x10) = rsv3
         
    • Constructor Detail

      • Parser

        public Parser​(WebSocketPolicy wspolicy,
                      org.eclipse.jetty.io.ByteBufferPool bufferPool)
    • Method Detail

      • assertSanePayloadLength

        private void assertSanePayloadLength​(long len)
      • configureFromExtensions

        public void configureFromExtensions​(java.util.List<? extends Extension> exts)
      • getIncomingFramesHandler

        public IncomingFrames getIncomingFramesHandler()
      • isRsv1InUse

        public boolean isRsv1InUse()
      • isRsv2InUse

        public boolean isRsv2InUse()
      • isRsv3InUse

        public boolean isRsv3InUse()
      • reset

        private void reset()
      • parseFrame

        private boolean parseFrame​(java.nio.ByteBuffer buffer)
        Parse the base framing protocol buffer.

        Note the first byte (fin,rsv1,rsv2,rsv3,opcode) are parsed by the parse(ByteBuffer) method

        Not overridable

        Parameters:
        buffer - the buffer to parse from.
        Returns:
        true if done parsing base framing protocol and ready for parsing of the payload. false if incomplete parsing of base framing protocol.
      • parsePayload

        private boolean parsePayload​(java.nio.ByteBuffer buffer)
        Implementation specific parsing of a payload
        Parameters:
        buffer - the payload buffer
        Returns:
        true if payload is done reading, false if incomplete
      • setIncomingFramesHandler

        public void setIncomingFramesHandler​(IncomingFrames incoming)
      • getMessagesIn

        public long getMessagesIn()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object