Home / Function/ SmtpResponse() — netty Function Reference

SmtpResponse() — netty Function Reference

Architecture documentation for the SmtpResponse() function in SmtpResponseDecoder.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  0ba21a04_844e_c443_be46_00b8f6c40861["SmtpResponse()"]
  676d2047_352d_72b6_2e56_db05dff1e4bc["SmtpResponseDecoder"]
  0ba21a04_844e_c443_be46_00b8f6c40861 -->|defined in| 676d2047_352d_72b6_2e56_db05dff1e4bc
  c0926e74_a270_c704_dfeb_8c3ef6168e99["parseCode()"]
  0ba21a04_844e_c443_be46_00b8f6c40861 -->|calls| c0926e74_a270_c704_dfeb_8c3ef6168e99
  style 0ba21a04_844e_c443_be46_00b8f6c40861 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-smtp/src/main/java/io/netty/handler/codec/smtp/SmtpResponseDecoder.java lines 44–97

    @Override
    protected SmtpResponse decode(ChannelHandlerContext ctx, ByteBuf buffer) throws Exception {
        ByteBuf frame = (ByteBuf) super.decode(ctx, buffer);
        if (frame == null) {
            // No full line received yet.
            return null;
        }
        try {
            final int readable = frame.readableBytes();
            final int readerIndex = frame.readerIndex();
            if (readable < 3) {
                throw newDecoderException(buffer, readerIndex, readable);
            }
            final int code = parseCode(frame);
            final int separator = frame.readByte();
            final CharSequence detail = frame.isReadable() ? frame.toString(CharsetUtil.US_ASCII) : null;

            List<CharSequence> details = this.details;

            switch (separator) {
            case ' ':
                // Marks the end of a response.
                this.details = null;
                if (details != null) {
                    if (detail != null) {
                        details.add(detail);
                    }
                } else {
                    if (detail == null) {
                        details = Collections.emptyList();
                    } else {
                        details = Collections.singletonList(detail);
                    }
                }
                return new DefaultSmtpResponse(code, details);
            case '-':
                // Multi-line response.
                if (detail != null) {
                    if (details == null) {
                        // Using initial capacity as it is very unlikely that we will receive a multi-line response
                        // with more then 3 lines.
                        this.details = details = new ArrayList<CharSequence>(4);
                    }
                    details.add(detail);
                }
                break;
            default:
                throw newDecoderException(buffer, readerIndex, readable);
            }
        } finally {
            frame.release();
        }
        return null;
    }

Domain

Subdomains

Calls

Frequently Asked Questions

What does SmtpResponse() do?
SmtpResponse() is a function in the netty codebase, defined in codec-smtp/src/main/java/io/netty/handler/codec/smtp/SmtpResponseDecoder.java.
Where is SmtpResponse() defined?
SmtpResponse() is defined in codec-smtp/src/main/java/io/netty/handler/codec/smtp/SmtpResponseDecoder.java at line 44.
What does SmtpResponse() call?
SmtpResponse() calls 1 function(s): parseCode.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free