From 2482e20063f5f2823bd4eac64737be31bc9f8d7f Mon Sep 17 00:00:00 2001 From: Graham Date: Mon, 21 Sep 2020 21:14:05 +0100 Subject: [PATCH] Add BufferModule for injecting ByteBufAllocator Signed-off-by: Graham --- buffer/build.gradle.kts | 1 + .../src/main/java/dev/openrs2/buffer/BufferModule.kt | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 buffer/src/main/java/dev/openrs2/buffer/BufferModule.kt diff --git a/buffer/build.gradle.kts b/buffer/build.gradle.kts index 6863d0af35..20e0adabe6 100644 --- a/buffer/build.gradle.kts +++ b/buffer/build.gradle.kts @@ -4,6 +4,7 @@ plugins { } dependencies { + api("com.google.inject:guice:${Versions.guice}") api("io.netty:netty-buffer:${Versions.netty}") implementation("com.google.guava:guava:${Versions.guava}") diff --git a/buffer/src/main/java/dev/openrs2/buffer/BufferModule.kt b/buffer/src/main/java/dev/openrs2/buffer/BufferModule.kt new file mode 100644 index 0000000000..f82d2888fb --- /dev/null +++ b/buffer/src/main/java/dev/openrs2/buffer/BufferModule.kt @@ -0,0 +1,12 @@ +package dev.openrs2.buffer + +import com.google.inject.AbstractModule +import io.netty.buffer.ByteBufAllocator +import io.netty.buffer.PooledByteBufAllocator + +public object BufferModule : AbstractModule() { + override fun configure() { + bind(ByteBufAllocator::class.java) + .toInstance(PooledByteBufAllocator.DEFAULT) + } +}