From e68f496302ef78e0b9e9d2328337cd55ceb53129 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Thu, 7 Jul 2022 10:13:03 +0200 Subject: [PATCH] Changed how byte arrays are read. --- pom.xml | 2 +- .../nl/andrewl/record_net/util/ExtendedDataInputStream.java | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 43608d6..03e5642 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ nl.andrewl record-net - 1.3.0 + 1.3.1 17 diff --git a/src/main/java/nl/andrewl/record_net/util/ExtendedDataInputStream.java b/src/main/java/nl/andrewl/record_net/util/ExtendedDataInputStream.java index 776ed0d..7a6ab0a 100644 --- a/src/main/java/nl/andrewl/record_net/util/ExtendedDataInputStream.java +++ b/src/main/java/nl/andrewl/record_net/util/ExtendedDataInputStream.java @@ -56,10 +56,7 @@ public class ExtendedDataInputStream extends DataInputStream { public byte[] readByteArray() throws IOException { int length = readInt(); if (length < 0) return null; - byte[] array = new byte[length]; - int readLength = read(array); - if (readLength != length) throw new IOException("Could not read complete byte array."); - return array; + return readNBytes(length); } public int[] readIntArray() throws IOException {