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

io.lettuce.core.codec.ByteBufferInputStream Maven / Gradle / Ivy

Go to download

Advanced and thread-safe Java Redis client for synchronous, asynchronous, and reactive usage. Supports Cluster, Sentinel, Pipelining, Auto-Reconnect, Codecs and much more.

The newest version!
package io.lettuce.core.codec;

import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;

class ByteBufferInputStream extends InputStream {

    private final ByteBuffer buffer;

    public ByteBufferInputStream(ByteBuffer b) {
        this.buffer = b;
    }

    @Override
    public int available() throws IOException {
        return buffer.remaining();
    }

    @Override
    public int read() throws IOException {
        if (buffer.remaining() > 0) {
            return (buffer.get() & 0xFF);
        }
        return -1;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy