From dead98e510b83d8284eb6636161f4e267ee94b70 Mon Sep 17 00:00:00 2001 From: TudbuT Date: Sun, 9 Jun 2024 22:29:15 +0200 Subject: [PATCH] make readByteArray not block indefinitely --- src/main/java/de/tudbut/io/TypedInputStream.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/tudbut/io/TypedInputStream.java b/src/main/java/de/tudbut/io/TypedInputStream.java index c5f2459..8ee3b8a 100644 --- a/src/main/java/de/tudbut/io/TypedInputStream.java +++ b/src/main/java/de/tudbut/io/TypedInputStream.java @@ -119,7 +119,7 @@ public class TypedInputStream { public byte[] readByteArray() throws IOException { byte[] bytes = new byte[readInt()]; int n = 0; - while ((n += stream.read(bytes, n, bytes.length - n)) != 0); + while (n != (n += stream.read(bytes, n, bytes.length - n))); if(n != bytes.length) { byte[] cutBytes = new byte[n]; System.arraycopy(bytes, 0, cutBytes, 0, n);