Class StompSubframeEncoder

All Implemented Interfaces:
ChannelHandler, ChannelOutboundHandler

public class StompSubframeEncoder extends MessageToMessageEncoder<StompSubframe>
Encodes a StompFrame or a StompSubframe into a ByteBuf.
  • Field Details

    • ESCAPE_HEADER_KEY_CACHE_LIMIT

      private static final int ESCAPE_HEADER_KEY_CACHE_LIMIT
      See Also:
    • DEFAULT_LOAD_FACTOR

      private static final float DEFAULT_LOAD_FACTOR
      See Also:
    • ESCAPE_HEADER_KEY_CACHE

      private static final FastThreadLocal<java.util.LinkedHashMap<java.lang.CharSequence, java.lang.CharSequence>> ESCAPE_HEADER_KEY_CACHE
  • Constructor Details

    • StompSubframeEncoder

      public StompSubframeEncoder()
  • Method Details

    • encode

      protected void encode(ChannelHandlerContext ctx, StompSubframe msg, java.util.List<java.lang.Object> out) throws java.lang.Exception
      Description copied from class: MessageToMessageEncoder
      Encode from one message to an other. This method will be called for each written message that can be handled by this encoder.
      Specified by:
      encode in class MessageToMessageEncoder<StompSubframe>
      Parameters:
      ctx - the ChannelHandlerContext which this MessageToMessageEncoder belongs to
      msg - the message to encode to an other one
      out - the List into which the encoded msg should be added needs to do some kind of aggregation
      Throws:
      java.lang.Exception - is thrown if an error occurs
    • convertFullFrame

      protected java.lang.Object convertFullFrame(StompFrame original, ByteBuf encoded)
      An extension method to convert a STOMP encoded buffer to a different message type based on an original StompFrame full frame.

      By default an encoded buffer is returned as is.

    • convertHeadersSubFrame

      protected java.lang.Object convertHeadersSubFrame(StompHeadersSubframe original, ByteBuf encoded)
      An extension method to convert a STOMP encoded buffer to a different message type based on an original StompHeadersSubframe headers sub frame.

      By default an encoded buffer is returned as is.

    • convertContentSubFrame

      protected java.lang.Object convertContentSubFrame(StompContentSubframe original, ByteBuf encoded)
      An extension method to convert a STOMP encoded buffer to a different message type based on an original StompHeadersSubframe content sub frame.

      By default an encoded buffer is returned as is.

    • headersSubFrameSize

      protected int headersSubFrameSize(StompHeadersSubframe headersSubframe)
      Returns a heuristic size for headers (32 bytes per header line) + (2 bytes for colon and eol) + (additional command buffer).
    • encodeFullFrame

      private ByteBuf encodeFullFrame(StompFrame frame, ChannelHandlerContext ctx)
    • encodeHeaders

      private static void encodeHeaders(StompHeadersSubframe frame, ByteBuf buf)
    • encodeContent

      private static ByteBuf encodeContent(StompContentSubframe content, ChannelHandlerContext ctx)
    • shouldEscape

      private static boolean shouldEscape(StompCommand command)
    • validateNoIllegalCharacters

      private static void validateNoIllegalCharacters(StompCommand command, java.lang.CharSequence value, java.lang.String type)
    • newIllegalCharacterException

      private static java.lang.IllegalArgumentException newIllegalCharacterException(StompCommand command, java.lang.String type, int index)
    • escape

      private static java.lang.CharSequence escape(StompCommand command, java.lang.String type, java.lang.CharSequence input)
    • escapeBuilder

      private static AppendableCharSequence escapeBuilder(AppendableCharSequence builder, java.lang.CharSequence input, int offset)