From 770a1d17ab5098589527d8273406892fe0ac0a22 Mon Sep 17 00:00:00 2001 From: Ulrik Guenther Date: Thu, 18 Apr 2024 21:48:18 +0200 Subject: [PATCH] SystemHelpers: Let dumpToFile() return the file handle used --- src/main/kotlin/graphics/scenery/utils/SystemHelpers.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/graphics/scenery/utils/SystemHelpers.kt b/src/main/kotlin/graphics/scenery/utils/SystemHelpers.kt index 1d67718d5..6f04d9aea 100644 --- a/src/main/kotlin/graphics/scenery/utils/SystemHelpers.kt +++ b/src/main/kotlin/graphics/scenery/utils/SystemHelpers.kt @@ -241,18 +241,21 @@ class SystemHelpers { * * @param[buf] The ByteBuffer to dump. */ - fun dumpToFile(buf: ByteBuffer, filename: String) { + fun dumpToFile(buf: ByteBuffer, filename: String): File? { try { val view = buf.duplicate().order(ByteOrder.LITTLE_ENDIAN) val file = File(filename) val channel = FileOutputStream(file, false).channel channel.write(view) channel.close() + + return file } catch (e: Exception) { logger.error("Unable to dump byte buffer to $filename") e.printStackTrace() } + return null } /**