Changed how byte arrays are read.
This commit is contained in:
parent
d5507073f8
commit
e68f496302
2
pom.xml
2
pom.xml
|
@ -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>
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue