mirror of
https://github.com/tursom/TursomServer.git
synced 2025-01-22 18:20:32 +08:00
使NettyByteBuffer支持release
This commit is contained in:
parent
09699dc619
commit
066d78bbed
@ -31,6 +31,7 @@ class NettyByteBuffer(
|
|||||||
byteBuf.readerIndex(value)
|
byteBuf.readerIndex(value)
|
||||||
}
|
}
|
||||||
override val resized: Boolean get() = false
|
override val resized: Boolean get() = false
|
||||||
|
override var closed: Boolean = false
|
||||||
|
|
||||||
override fun readBuffer(): java.nio.ByteBuffer {
|
override fun readBuffer(): java.nio.ByteBuffer {
|
||||||
return byteBuf.internalNioBuffer(readPosition, readable).slice()
|
return byteBuf.internalNioBuffer(readPosition, readable).slice()
|
||||||
@ -129,4 +130,11 @@ class NettyByteBuffer(
|
|||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return "Nettyjava.nio.ByteBuffer(byteBuf=$byteBuf)"
|
return "Nettyjava.nio.ByteBuffer(byteBuf=$byteBuf)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun close() {
|
||||||
|
if (closed) {
|
||||||
|
closed = true
|
||||||
|
byteBuf.release()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user