Skip to content

Commit 481338a

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 5e122b3 + 798aaa3 commit 481338a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/kotlin/ab/appBuffer.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ object appBuffer {
190190
return bytes
191191
}
192192

193+
inline fun bufferOfUtf8(string: String, nullTerminated: Boolean = true): ByteBuffer {
194+
val bytes = buffer(MemoryUtil.memLengthUTF8(string, nullTerminated))
195+
MemoryUtil.memUTF8(string, nullTerminated, bytes)
196+
return bytes
197+
}
198+
193199
inline fun intBuffer(size: Int): IntBuffer = MemoryUtil.memIntBuffer(ptr.advance(Int.BYTES * size), size)
194200
inline fun intBuffer(size: Int, block: (Int) -> Int): IntBuffer {
195201
val res = intBuffer(size)

0 commit comments

Comments
 (0)