
io.lettuce.core.codec.ByteBufferInputStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of lettuce-core Show documentation
Show all versions of lettuce-core Show documentation
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