All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.binaryfoo.hex.HexDumpElement.kt Maven / Gradle / Ivy

There is a newer version: 0.1.8
Show newest version
package io.github.binaryfoo.hex

import java.util.*
import kotlin.text.substring

data class HexDumpElement(val value: String, val byteOffset: Int) {

    companion object {
        @JvmStatic fun splitIntoByteLengthStrings(hexString: String, startIndexInBytes: Int): List {
            val elements = ArrayList()
            var byteOffset = startIndexInBytes
            for (i in 0..hexString.length-2 step 2) {
                elements.add(HexDumpElement(hexString.substring(i, i + 2), byteOffset++))
            }
            return elements
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy