This commit is contained in:
redkale
2024-09-28 19:39:45 +08:00
parent b50a28132b
commit 7536744d93
4 changed files with 76 additions and 77 deletions

View File

@@ -33,14 +33,6 @@ public class ProtobufByteBufferReader extends ProtobufReader {
return false;
}
protected int remaining() {
int count = 0;
for (int i = currentIndex; i < buffers.length; i++) {
count += buffers[i].remaining();
}
return count;
}
protected byte nextByte() {
if (this.currentBuffer.hasRemaining()) {
this.position++;
@@ -84,6 +76,9 @@ public class ProtobufByteBufferReader extends ProtobufReader {
@Override
public boolean hasNext() {
if (this.limit > 0 && (this.position + 1) >= this.limit) {
return false;
}
if (currentBuffer.hasRemaining()) {
return true;
}

View File

@@ -18,14 +18,14 @@ public class ProtobufReader extends Reader {
protected int position = -1;
protected byte[] content;
protected int limit;
protected int limit = -1;
protected int cacheTag = Integer.MIN_VALUE;
protected boolean enumtostring;
private byte[] content;
public ProtobufReader() {
// do nothing
}
@@ -284,6 +284,7 @@ public class ProtobufReader extends Reader {
public final int[] readInts() {
int len = readRawVarint32();
System.out.println("等到长度: " + len);
List<Integer> list = new ArrayList<>(len);
while (len > 0) {
int val = readInt();

View File

@@ -33,12 +33,6 @@ class ProtobufStreamReader extends ProtobufByteBufferReader {
return false;
}
@Override
protected int remaining() {
int count = 0;
return count;
}
@Override
protected byte nextByte() {
if (backByte != null) {