Testing Pi Logic integrations.
Luke K Locust Jr

Luke K Locust Jr @luke_klocustjr_e0662da2

About: πVixenpπVixenπLKLJR

Joined:
Dec 17, 2024

Testing Pi Logic integrations.

Publish Date: Jan 8
1 0

fun invertBinaryFile(inputFilePath: String, outputFilePath: String) {
val inputFile = File(inputFilePath)
val outputFile = File(outputFilePath)

inputFile.inputStream().use { inputStream ->
    outputFile.outputStream().use { outputStream ->
        val buffer = ByteArray(1024)
        var bytesRead: Int
        while (inputStream.read(buffer).also { bytesRead = it } != -1) {
            val invertedBuffer = buffer.map { it.inv() }.toByteArray() // Bitwise NOT
            outputStream.write(invertedBuffer, 0, bytesRead)
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

}

Comments 0 total

    Add comment