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 <gpe@openrs2.org>
pull/132/head
Graham 3 years ago
parent ba60fecb50
commit 7d041e6e22
  1. 2
      cache/src/test/kotlin/org/openrs2/cache/Js5CompressionTest.kt
  2. 2
      cache/src/test/kotlin/org/openrs2/cache/Js5IndexTest.kt
  3. 2
      protocol/src/test/kotlin/org/openrs2/protocol/js5/Js5ResponseDecoderTest.kt
  4. 2
      protocol/src/test/kotlin/org/openrs2/protocol/js5/Js5ResponseEncoderTest.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())
}
}

@ -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())
}
}

@ -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())
}
}
}

@ -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())
}
}
}

Loading…
Cancel
Save