private byte[] readyFully(ServletInputStream in, int totalSize) throws Exception {
byte[] retval = new byte[totalSize];
int bytesRead = 0;
while (bytesRead < totalSize) {
try {
int read = in.read(retval, bytesRead, totalSize - bytesRead);
if (read == -1) {
throw new RpcCallException(RpcCallException.Category.InternalServerError,
"Unable to read complete request or response");
}
bytesRead += read;
} catch (IOException e) {
throw new RpcCallException(RpcCallException.Category.InternalServerError,
"IOException reading data: " + e);
}
}
return retval;
}
ProtobufHandler.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:ja-micro
作者:
评论列表
文章目录