mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-22 16:09:18 +01:00
Fix the buffer size in the getBytesFromStream function
This commit is contained in:
parent
a5bc706cb9
commit
31fcc4fc6d
@ -35,7 +35,12 @@ public final class StreamUtils {
|
|||||||
public static byte[] getBytesFromStream(InputStream in, int size) throws IOException {
|
public static byte[] getBytesFromStream(InputStream in, int size) throws IOException {
|
||||||
synchronized (in) {
|
synchronized (in) {
|
||||||
byte[] result = new byte[size];
|
byte[] result = new byte[size];
|
||||||
byte[] buffer = new byte[0x8000];
|
byte[] buffer = null;
|
||||||
|
if (size < 0x8000) {
|
||||||
|
buffer = new byte[size];
|
||||||
|
} else {
|
||||||
|
buffer = new byte[0x8000];
|
||||||
|
}
|
||||||
int totalRead = 0;
|
int totalRead = 0;
|
||||||
do {
|
do {
|
||||||
int read = in.read(buffer);
|
int read = in.read(buffer);
|
||||||
|
Loading…
Reference in New Issue
Block a user