From 7d041e6e2289b17aac5cd533720813a87a712695 Mon Sep 17 00:00:00 2001 From: Graham Date: Mon, 5 Apr 2021 15:27:07 +0100 Subject: [PATCH] Replace readAllBytes() with readBytes() It's more concise and I suspect Kotlin's implementation is better than Java's, as it seems to take available() into account. Signed-off-by: Graham --- cache/src/test/kotlin/org/openrs2/cache/Js5CompressionTest.kt | 2 +- cache/src/test/kotlin/org/openrs2/cache/Js5IndexTest.kt | 2 +- .../kotlin/org/openrs2/protocol/js5/Js5ResponseDecoderTest.kt | 2 +- .../kotlin/org/openrs2/protocol/js5/Js5ResponseEncoderTest.kt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cache/src/test/kotlin/org/openrs2/cache/Js5CompressionTest.kt b/cache/src/test/kotlin/org/openrs2/cache/Js5CompressionTest.kt index f3de03d75e..1919b7df21 100644 --- a/cache/src/test/kotlin/org/openrs2/cache/Js5CompressionTest.kt +++ b/cache/src/test/kotlin/org/openrs2/cache/Js5CompressionTest.kt @@ -684,7 +684,7 @@ class Js5CompressionTest { private fun read(name: String): ByteBuf { Js5CompressionTest::class.java.getResourceAsStream("compression/$name").use { input -> - return Unpooled.wrappedBuffer(input.readAllBytes()) + return Unpooled.wrappedBuffer(input.readBytes()) } } diff --git a/cache/src/test/kotlin/org/openrs2/cache/Js5IndexTest.kt b/cache/src/test/kotlin/org/openrs2/cache/Js5IndexTest.kt index 7c250051c9..c4d2fdf59d 100644 --- a/cache/src/test/kotlin/org/openrs2/cache/Js5IndexTest.kt +++ b/cache/src/test/kotlin/org/openrs2/cache/Js5IndexTest.kt @@ -317,7 +317,7 @@ class Js5IndexTest { private fun read(name: String): ByteBuf { Js5IndexTest::class.java.getResourceAsStream("index/$name").use { input -> - return Unpooled.wrappedBuffer(input.readAllBytes()) + return Unpooled.wrappedBuffer(input.readBytes()) } } diff --git a/protocol/src/test/kotlin/org/openrs2/protocol/js5/Js5ResponseDecoderTest.kt b/protocol/src/test/kotlin/org/openrs2/protocol/js5/Js5ResponseDecoderTest.kt index c8d5e863f6..d6ee023175 100644 --- a/protocol/src/test/kotlin/org/openrs2/protocol/js5/Js5ResponseDecoderTest.kt +++ b/protocol/src/test/kotlin/org/openrs2/protocol/js5/Js5ResponseDecoderTest.kt @@ -106,7 +106,7 @@ class Js5ResponseDecoderTest { private fun read(name: String): ByteBuf { Js5ResponseDecoderTest::class.java.getResourceAsStream(name).use { input -> - return Unpooled.wrappedBuffer(input.readAllBytes()) + return Unpooled.wrappedBuffer(input.readBytes()) } } } diff --git a/protocol/src/test/kotlin/org/openrs2/protocol/js5/Js5ResponseEncoderTest.kt b/protocol/src/test/kotlin/org/openrs2/protocol/js5/Js5ResponseEncoderTest.kt index f903ea6bf3..0c8a21f0c1 100644 --- a/protocol/src/test/kotlin/org/openrs2/protocol/js5/Js5ResponseEncoderTest.kt +++ b/protocol/src/test/kotlin/org/openrs2/protocol/js5/Js5ResponseEncoderTest.kt @@ -56,7 +56,7 @@ class Js5ResponseEncoderTest { private fun read(name: String): ByteBuf { Js5ResponseEncoderTest::class.java.getResourceAsStream(name).use { input -> - return Unpooled.wrappedBuffer(input.readAllBytes()) + return Unpooled.wrappedBuffer(input.readBytes()) } } }