Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit25751ab

Browse files
committed
[2.0.0-SNAPSHOT]
Default converter parsing optimized
1 parentf5b2edb commit25751ab

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎src/main/java/io/goodforgod/api/etherscan/EthScanAPIBuilder.java‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
importcom.google.gson.Gson;
44
importio.goodforgod.api.etherscan.error.EtherScanKeyException;
5+
importio.goodforgod.api.etherscan.error.EtherScanParseException;
56
importio.goodforgod.api.etherscan.http.EthHttpClient;
67
importio.goodforgod.api.etherscan.http.impl.UrlEthHttpClient;
78
importio.goodforgod.api.etherscan.manager.RequestQueueManager;
89
importio.goodforgod.api.etherscan.util.BasicUtils;
910
importio.goodforgod.gson.configuration.GsonConfiguration;
11+
importjava.io.ByteArrayInputStream;
12+
importjava.io.IOException;
13+
importjava.io.InputStreamReader;
1014
importjava.nio.charset.StandardCharsets;
1115
importjava.util.function.Supplier;
1216
importorg.jetbrains.annotations.NotNull;
@@ -30,8 +34,11 @@ final class EthScanAPIBuilder implements EtherScanAPI.Builder {
3034

3135
@Override
3236
public <T>@NotNullTfromJson(byte[]jsonAsByteArray,@NotNullClass<T>type) {
33-
finalStringjsonAsString =newString(jsonAsByteArray,StandardCharsets.UTF_8);
34-
returngson.fromJson(jsonAsString,type);
37+
try (InputStreamReaderisr =newInputStreamReader(newByteArrayInputStream(jsonAsByteArray))) {
38+
returngson.fromJson(isr,type);
39+
}catch (IOExceptione) {
40+
thrownewEtherScanParseException(e.getMessage(),e,newString(jsonAsByteArray,StandardCharsets.UTF_8));
41+
}
3542
}
3643
};
3744

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp