Home / Class/ SeekAheadOptimize Class — netty Architecture

SeekAheadOptimize Class — netty Architecture

Architecture documentation for the SeekAheadOptimize class in HttpPostBodyUtil.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  7788b541_012f_8aba_f479_bc498531d13b["SeekAheadOptimize"]
  f38a6669_d982_74d4_e24c_5fdbabffde3f["HttpPostBodyUtil.java"]
  7788b541_012f_8aba_f479_bc498531d13b -->|defined in| f38a6669_d982_74d4_e24c_5fdbabffde3f
  34cf44cf_f9a1_52e8_07f5_a69854fb6f86["SeekAheadOptimize()"]
  7788b541_012f_8aba_f479_bc498531d13b -->|method| 34cf44cf_f9a1_52e8_07f5_a69854fb6f86
  71cb261a_5ec1_cbd7_0fa1_255a6f3a4e8f["setReadPosition()"]
  7788b541_012f_8aba_f479_bc498531d13b -->|method| 71cb261a_5ec1_cbd7_0fa1_255a6f3a4e8f
  07fe2156_1398_c85f_89fd_5dd65e9b79fc["getReadPosition()"]
  7788b541_012f_8aba_f479_bc498531d13b -->|method| 07fe2156_1398_c85f_89fd_5dd65e9b79fc

Relationship Graph

Source Code

codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostBodyUtil.java lines 83–124

    static class SeekAheadOptimize {
        byte[] bytes;
        int readerIndex;
        int pos;
        int origPos;
        int limit;
        ByteBuf buffer;

        /**
         * @param buffer buffer with a backing byte array
         */
        SeekAheadOptimize(ByteBuf buffer) {
            if (!buffer.hasArray()) {
                throw new IllegalArgumentException("buffer hasn't backing byte array");
            }
            this.buffer = buffer;
            bytes = buffer.array();
            readerIndex = buffer.readerIndex();
            origPos = pos = buffer.arrayOffset() + readerIndex;
            limit = buffer.arrayOffset() + buffer.writerIndex();
        }

        /**
        *
        * @param minus this value will be used as (currentPos - minus) to set
        * the current readerIndex in the buffer.
        */
        void setReadPosition(int minus) {
            pos -= minus;
            readerIndex = getReadPosition(pos);
            buffer.readerIndex(readerIndex);
        }

        /**
        *
        * @param index raw index of the array (pos in general)
        * @return the value equivalent of raw index to be used in readerIndex(value)
        */
        int getReadPosition(int index) {
            return index - origPos + readerIndex;
        }
    }

Frequently Asked Questions

What is the SeekAheadOptimize class?
SeekAheadOptimize is a class in the netty codebase, defined in codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostBodyUtil.java.
Where is SeekAheadOptimize defined?
SeekAheadOptimize is defined in codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostBodyUtil.java at line 83.

Analyze Your Own Codebase

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

Try Supermodel Free