org.eclipse.jetty.websocket

## Class WebSocketParserRFC6455

- java.lang.Object
- - org.eclipse.jetty.websocket.WebSocketParserRFC6455

- All Implemented Interfaces:
    WebSocketParser

      public class WebSocketParserRFC6455
      extends Object
      implements WebSocketParser

  Parser the WebSocket protocol.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `WebSocketParserRFC6455.State`

    - ### Nested classes/interfaces inherited from interface org.eclipse.jetty.websocket.WebSocketParser

      `WebSocketParser.FrameHandler`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `WebSocketParserRFC6455(WebSocketBuffers buffers, EndPoint endp, WebSocketParser.FrameHandler handler, boolean shouldBeMasked)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `fill(Buffer buffer)`
    `Buffer` | `getBuffer()`
    `boolean` | `isBufferEmpty()`
    `boolean` | `isFakeFragments()`
    `int` | `parseNext()` Parse to next event.
    `void` | `returnBuffer()`
    `void` | `setFakeFragments(boolean fakeFragments)`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### WebSocketParserRFC6455

          public WebSocketParserRFC6455(WebSocketBuffers buffers,
                                EndPoint endp,
                                WebSocketParser.FrameHandler handler,
                                boolean shouldBeMasked)

      Parameters:
        `buffers` - The buffers to use for parsing. Only the `Buffers.getBuffer()` is used. This should be a direct buffer if binary data is mostly used or an indirect buffer if utf-8 data is mostly used.
        `endp` - the endpoint
        `handler` - the handler to notify when a parse event occurs
        `shouldBeMasked` - whether masking should be handled

  - ### Method Detail

    - #### isFakeFragments

          public boolean isFakeFragments()

      Returns:
        True if fake fragments should be created for frames larger than the buffer.

    - #### setFakeFragments

          public void setFakeFragments(boolean fakeFragments)

      Parameters:
        `fakeFragments` - True if fake fragments should be created for frames larger than the buffer.

    - #### isBufferEmpty

          public boolean isBufferEmpty()

      Specified by:
        `isBufferEmpty` in interface `WebSocketParser`

    - #### getBuffer

          public Buffer getBuffer()

      Specified by:
        `getBuffer` in interface `WebSocketParser`

    - #### parseNext

          public int parseNext()

      Parse to next event. Parse to the next `WebSocketParser.FrameHandler` event or until no more data is available. Fill data from the `EndPoint` only as necessary.
      Specified by:
        `parseNext` in interface `WebSocketParser`
      Returns:
        An indication of progress or otherwise. -1 indicates EOF, 0 indicates that no bytes were read and no messages parsed. A positive number indicates either the bytes filled or the messages parsed.

    - #### fill

          public void fill(Buffer buffer)

      Specified by:
        `fill` in interface `WebSocketParser`

    - #### returnBuffer

          public void returnBuffer()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 1995-2012 Mort Bay Consulting. All Rights Reserved.