提交 d089b55f authored 作者: Thomas Mueller's avatar Thomas Mueller

StreamStore bugfixes

上级 6bf60960
...@@ -200,7 +200,7 @@ public class StreamStore { ...@@ -200,7 +200,7 @@ public class StreamStore {
* *
* @return the new key * @return the new key
*/ */
public long getAndIncrementNextKey() { private long getAndIncrementNextKey() {
long key = nextKey.getAndIncrement(); long key = nextKey.getAndIncrement();
if (!map.containsKey(key)) { if (!map.containsKey(key)) {
return key; return key;
...@@ -385,6 +385,9 @@ public class StreamStore { ...@@ -385,6 +385,9 @@ public class StreamStore {
@Override @Override
public int read(byte[] b, int off, int len) { public int read(byte[] b, int off, int len) {
if (len <= 0) {
return 0;
}
while (true) { while (true) {
if (buffer == null) { if (buffer == null) {
buffer = nextBuffer(); buffer = nextBuffer();
...@@ -429,7 +432,7 @@ public class StreamStore { ...@@ -429,7 +432,7 @@ public class StreamStore {
return new ByteArrayInputStream(data, s, data.length - s); return new ByteArrayInputStream(data, s, data.length - s);
} }
case 2: { case 2: {
long len = DataUtils.readVarInt(idBuffer); long len = DataUtils.readVarLong(idBuffer);
long key = DataUtils.readVarLong(idBuffer); long key = DataUtils.readVarLong(idBuffer);
if (skip >= len) { if (skip >= len) {
skip -= len; skip -= len;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论