mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-29 15:37:59 +01:00
Merge branch 'master' into hdskins_rewrites
This commit is contained in:
commit
cf39a3a02d
1 changed files with 2 additions and 3 deletions
|
@ -10,7 +10,6 @@ import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
@ -52,13 +51,13 @@ public interface MoreHttpResponses extends AutoCloseable {
|
||||||
}
|
}
|
||||||
|
|
||||||
default <T> T json(Class<T> type) throws IOException {
|
default <T> T json(Class<T> type) throws IOException {
|
||||||
try (Reader reader = new InputStreamReader(getResponse().getEntity().getContent())) {
|
try (BufferedReader reader = getReader()) {
|
||||||
return SkinServer.gson.fromJson(reader, type);
|
return SkinServer.gson.fromJson(reader, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
default <T> T json(Type type) throws IOException {
|
default <T> T json(Type type) throws IOException {
|
||||||
try (Reader reader = new InputStreamReader(getResponse().getEntity().getContent())) {
|
try (BufferedReader reader = getReader()) {
|
||||||
return SkinServer.gson.fromJson(reader, type);
|
return SkinServer.gson.fromJson(reader, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue