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 f3de03d7..1919b7df 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 7c250051..c4d2fdf5 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 c8d5e863..d6ee0231 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 f903ea6b..0c8a21f0 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()) } } }