自行建设,补充这部分功能,给出具体的表设计和代码实现,同云端服务端一起部署
This commit is contained in:
1 parent
cab8056412
commit
b3419aa389
15 files changed
+1369
-14
No files matched your search
@@ -75,13 +75,19 @@ public final class RentalHttp {
|
||||
}
|
||||
|
||||
public static String body(Response response) throws IOException {
|
||||
return body(response, 1024 * 1024);
|
||||
}
|
||||
|
||||
/** 完整区块JSON可能超过普通RPC的1MiB限制;仅受信区块查询允许显式提高至16MiB。 */
|
||||
public static String body(Response response, int maxBytes) throws IOException {
|
||||
require(maxBytes > 0 && maxBytes <= 16 * 1024 * 1024, "RPC响应上限配置错误");
|
||||
require(response.isSuccessful() && response.body() != null, "RPC响应失败");
|
||||
java.io.InputStream stream = response.body().byteStream();
|
||||
java.io.ByteArrayOutputStream output = new java.io.ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[4096];
|
||||
int count;
|
||||
while ((count = stream.read(buffer)) != -1) {
|
||||
require(output.size() + count <= 1024 * 1024, "RPC响应超过限制");
|
||||
require(output.size() + count <= maxBytes, "RPC响应超过限制");
|
||||
output.write(buffer, 0, count);
|
||||
}
|
||||
return new String(output.toByteArray(), java.nio.charset.StandardCharsets.UTF_8);
|
||||
|
||||
Reference in new issue
Block a user