mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 22:38:00 +01:00
Add a bytes() method for MoreHttpResponses
This commit is contained in:
parent
0f454b753c
commit
e296d87376
1 changed files with 7 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
package com.voxelmodpack.hdskins.util;
|
package com.voxelmodpack.hdskins.util;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteStreams;
|
||||||
import com.google.common.io.CharStreams;
|
import com.google.common.io.CharStreams;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.voxelmodpack.hdskins.server.SkinServer;
|
import com.voxelmodpack.hdskins.server.SkinServer;
|
||||||
|
@ -48,6 +49,12 @@ public interface MoreHttpResponses extends AutoCloseable {
|
||||||
return new BufferedReader(new InputStreamReader(getInputStream(), StandardCharsets.UTF_8));
|
return new BufferedReader(new InputStreamReader(getInputStream(), StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default byte[] bytes() throws IOException {
|
||||||
|
try (InputStream input = getInputStream()) {
|
||||||
|
return ByteStreams.toByteArray(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default String text() throws IOException {
|
default String text() throws IOException {
|
||||||
try (BufferedReader reader = getReader()) {
|
try (BufferedReader reader = getReader()) {
|
||||||
return CharStreams.toString(reader);
|
return CharStreams.toString(reader);
|
||||||
|
|
Loading…
Reference in a new issue