diff --git a/utils/src/main/kotlin/cn/tursom/utils/bytebuffer/NettyByteBuffer.kt b/utils/src/main/kotlin/cn/tursom/utils/bytebuffer/NettyByteBuffer.kt index 785a5ce..cc64b4e 100644 --- a/utils/src/main/kotlin/cn/tursom/utils/bytebuffer/NettyByteBuffer.kt +++ b/utils/src/main/kotlin/cn/tursom/utils/bytebuffer/NettyByteBuffer.kt @@ -31,6 +31,7 @@ class NettyByteBuffer( byteBuf.readerIndex(value) } override val resized: Boolean get() = false + override var closed: Boolean = false override fun readBuffer(): java.nio.ByteBuffer { return byteBuf.internalNioBuffer(readPosition, readable).slice() @@ -129,4 +130,11 @@ class NettyByteBuffer( override fun toString(): String { return "Nettyjava.nio.ByteBuffer(byteBuf=$byteBuf)" } + + override fun close() { + if (closed) { + closed = true + byteBuf.release() + } + } } \ No newline at end of file