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 org.apache.commons.lang.builder.EqualsBuilder
import org.apache.commons.lang.builder.HashCodeBuilder
import org.apache.commons.lang.builder.ToStringBuilder
import org.apache.commons.lang.builder.ToStringStyle
import java.util.ArrayList
import kotlin.platform.platformStatic

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

    class object {
        platformStatic public 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