Changed how byte arrays are read.

This commit is contained in:
Andrew Lalis 2022-07-07 10:13:03 +02:00
parent d5507073f8
commit e68f496302
2 changed files with 2 additions and 5 deletions

View File

@ -6,7 +6,7 @@
<groupId>nl.andrewl</groupId> <groupId>nl.andrewl</groupId>
<artifactId>record-net</artifactId> <artifactId>record-net</artifactId>
<version>1.3.0</version> <version>1.3.1</version>
<properties> <properties>
<maven.compiler.source>17</maven.compiler.source> <maven.compiler.source>17</maven.compiler.source>

View File

@ -56,10 +56,7 @@ public class ExtendedDataInputStream extends DataInputStream {
public byte[] readByteArray() throws IOException { public byte[] readByteArray() throws IOException {
int length = readInt(); int length = readInt();
if (length < 0) return null; if (length < 0) return null;
byte[] array = new byte[length]; return readNBytes(length);
int readLength = read(array);
if (readLength != length) throw new IOException("Could not read complete byte array.");
return array;
} }
public int[] readIntArray() throws IOException { public int[] readIntArray() throws IOException {