6.2. 二进制流(Binary Stream)
Redisson的分布式RBinaryStream
Java对象同时提供了InputStream
接口和OutputStream
接口的实现。流的最大容量受Redis主节点的内存大小限制。
RBinaryStream stream = redisson.getBinaryStream("anyStream");
byte[] content = ...
stream.set(content);
InputStream is = stream.getInputStream();
byte[] readBuffer = new byte[512];
is.read(readBuffer);
OutputStream os = stream.getOuputStream();
byte[] contentToWrite = ...
os.write(contentToWrite);