Class SmtpResponseDecoder

All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler

@UnstableApi public final class SmtpResponseDecoder extends LineBasedFrameDecoder
Decoder for SMTP responses.
  • Field Details

    • DEFAULT_MAX_RESPONSE_SIZE

      private static final int DEFAULT_MAX_RESPONSE_SIZE
      See Also:
    • DETAIL_ENTRY_OVERHEAD

      private static final int DETAIL_ENTRY_OVERHEAD
      See Also:
    • maxResponseSize

      private final int maxResponseSize
    • details

      private List<CharSequence> details
    • responseSize

      private long responseSize
  • Constructor Details

    • SmtpResponseDecoder

      public SmtpResponseDecoder(int maxLineLength)
      Creates a new instance that enforces the given maxLineLength and a default limit of 64 KiB on the accumulated size of a multi-line response.
      Parameters:
      maxLineLength - the maximum length of a single response line, in bytes.
    • SmtpResponseDecoder

      public SmtpResponseDecoder(int maxLineLength, int maxResponseSize)
      Creates a new instance that enforces the given maxLineLength and maxResponseSize.

      The lines of a multi-line response are buffered until its terminating line arrives. maxResponseSize bounds that buffering. Once it is exceeded, decoding fails with a TooLongFrameException. The limit is approximate and tracks retained memory rather than bytes received, as it charges each buffered line a fixed object overhead in addition to its detail bytes, and ignores the response code, the separator and the terminating line.

      Parameters:
      maxLineLength - the maximum length of a single response line, in bytes.
      maxResponseSize - the maximum accumulated size of a multi-line response, in bytes.
  • Method Details