這裏的多個大尺寸在消息模式單一codeInputStream:>協議緩衝無法解析具有消息
message ServerResponse {
optional string ReferenceCode = 1;
optional NestedMessageProto.NestedMessage NestedMessage = 2;//Huge size data in response
optional bool Success = 3 [default = false];
repeated Errors Errors = 4;
}
下面是用於獲取從服務響應並調用原應答的方法的代碼。
String apiResponse = Server Response
protoResponseClass.parseFrom(apiResponse.getBytes())
its failing when reading the NestedMessage response on below bold line
public int pushLimit(int byteLimit) throws InvalidProtocolBufferException {
if (byteLimit < 0) {
throw InvalidProtocolBufferException.negativeSize();
}
byteLimit += totalBytesRetired + bufferPos;
if (byteLimit > currentLimit) {
currentLimit = byteLimit + currentLimit;
}
final int oldLimit = currentLimit;
**if (byteLimit > oldLimit) {
throw InvalidProtocolBufferException.truncatedMessage();
}**
currentLimit = byteLimit;
recomputeBufferSizeAfterLimit();
return oldLimit;
}
當其讀取嵌套消息時,字節限制變得大於舊限制。 什麼是解決方案?
由於
請花費更多的精力來設置您的帖子格式。由於缺少縮進和隨機空白行,因此您的代碼目前很難閱讀。 – 2014-09-24 06:14:02