org.springframework.web.socket.adapter.standard

Class ConvertingEncoderDecoderSupport<T,M>

  • java.lang.Object
    • org.springframework.web.socket.adapter.standard.ConvertingEncoderDecoderSupport<T,M>
    • Constructor Detail

      • ConvertingEncoderDecoderSupport

        public ConvertingEncoderDecoderSupport()
    • Method Detail

      • init

        public void init(javax.websocket.EndpointConfig config)
        Called to initialize the encoder/decoder.
        See Also:
        Encoder.init(EndpointConfig), Decoder.init(EndpointConfig)
      • destroy

        public void destroy()
        Called to destroy the encoder/decoder.
        See Also:
        Encoder.destroy(), Decoder.destroy()
      • getType

        protected TypeDescriptor getType()
        Returns the type being converted. By default the type is resolved using the generic arguments of the class.
      • getMessageType

        protected TypeDescriptor getMessageType()
        Returns the websocket message type. By default the type is resolved using the generic arguments of the class.
      • encode

        @Nullable
        public M encode(T object)
                           throws javax.websocket.EncodeException
        Encode an object to a message.
        Throws:
        javax.websocket.EncodeException
        See Also:
        Encoder.Text.encode(Object), Encoder.Binary.encode(Object)
      • willDecode

        public boolean willDecode(M bytes)
        Determine if a given message can be decoded.
        See Also:
        decode(Object), Decoder.Text.willDecode(String), Decoder.Binary.willDecode(ByteBuffer)
      • decode

        @Nullable
        public T decode(M message)
                           throws javax.websocket.DecodeException
        Decode the a message into an object.
        Throws:
        javax.websocket.DecodeException
        See Also:
        Decoder.Text.decode(String), Decoder.Binary.decode(ByteBuffer)