All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.netty.protocol.dubbo.Body Maven / Gradle / Ivy

The newest version!
package com.github.netty.protocol.dubbo;

import io.netty.buffer.ByteBuf;

public abstract class Body {
    ByteBuf bodyBytes;
    int markReaderIndex;

    public ByteBuf encode() {
        if (bodyBytes != null) {
            bodyBytes.readerIndex(markReaderIndex);
        }
        return bodyBytes;
    }

    public boolean release() {
        if (bodyBytes != null && bodyBytes.refCnt() > 0) {
            return bodyBytes.release();
        } else {
            return false;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy