Class Frame.Builder

  • Enclosing class:
    Frame

    public static final class Frame.Builder
    extends java.lang.Object
    Frame builder.
    • Constructor Detail

      • Builder

        public Builder()
        Constructor.
      • Builder

        public Builder​(Frame frame)
        Constructor.
        Parameters:
        frame - frame used as a base for building new frame.
    • Method Detail

      • build

        public Frame build()
        Build new frame.
        Returns:
        built frame.
      • fin

        public Frame.Builder fin​(boolean fin)
        Set FIN flag.
        Parameters:
        fin - value to be set as FIN.
        Returns:
        updated Frame.Builder instance.
      • rsv1

        public Frame.Builder rsv1​(boolean rsv1)
        Set RSV1 flag.
        Parameters:
        rsv1 - value to be set as RSV1.
        Returns:
        updated Frame.Builder instance.
      • rsv2

        public Frame.Builder rsv2​(boolean rsv2)
        Set RSV2 flag.
        Parameters:
        rsv2 - value to be set as RSV2.
        Returns:
        updated Frame.Builder instance.
      • rsv3

        public Frame.Builder rsv3​(boolean rsv3)
        Set RSV3 flag.
        Parameters:
        rsv3 - value to be set as RSV3.
        Returns:
        updated Frame.Builder instance.
      • mask

        public Frame.Builder mask​(boolean mask)
        Currently not used.
        Parameters:
        mask - not used.
        Returns:
        updated Frame.Builder instance.
      • opcode

        public Frame.Builder opcode​(byte opcode)
        Set opcode.
        Parameters:
        opcode - opcode to be set. (4 bits).
        Returns:
        updated Frame.Builder instance.
      • payloadLength

        public Frame.Builder payloadLength​(long payloadLength)
        Set payload length.

        Payload length is automatically set to payloadData length when payloadData(byte[]) is called. This method can limit the data used for this frame by setting smaller value than payloadData.length.

        Parameters:
        payloadLength - payload length. Must not be greater than payloadData.length.
        Returns:
        updated Frame.Builder instance.
        See Also:
        payloadData(byte[])
      • maskingKey

        public Frame.Builder maskingKey​(java.lang.Integer maskingKey)
        Set masking key. Default value is null.
        Parameters:
        maskingKey - masking key.
        Returns:
        updated Frame.Builder instance.