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

com.firefly.net.AbstractByteBufferArrayOutputEntry Maven / Gradle / Ivy

There is a newer version: 5.0.0-dev6
Show newest version
package com.firefly.net;

import com.firefly.utils.concurrent.Callback;

import java.nio.ByteBuffer;

abstract public class AbstractByteBufferArrayOutputEntry extends AbstractOutputEntry {

    protected int lastOffset = 0;

    public AbstractByteBufferArrayOutputEntry(Callback callback, ByteBuffer[] data) {
        super(callback, data);
    }

    public int getOffset() {
        for (int i = lastOffset; i < data.length; i++) {
            if (data[i].hasRemaining()) {
                lastOffset = i;
                return i;
            }
        }
        return 0;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy