Interface ByteArray

All Superinterfaces:
Comparable<ByteArray>
All Known Subinterfaces:
EcdhSharedSecret, EcdsaSignature, SchnorrSignature
All Known Implementing Classes:
ByteArrayBase, EcdhSharedSecretImpl, EcdsaSignatureImpl, SchnorrSignatureImpl, SecpFieldElementImpl, SecpXOnlyPubKeyImpl

public interface ByteArray extends Comparable<ByteArray>
An effectively-immutable sequence of bytes.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Get the bytes as an array
    default int
    default String
    Format the bytes as a hex string
    static BigInteger
    toInteger(byte[] bytes)
    Utility to convert big-endian byte[] to integer
  • Method Details

    • bytes

      byte[] bytes()
      Get the bytes as an array
      Returns:
      the bytes as an array
    • formatHex

      default String formatHex()
      Format the bytes as a hex string
      Returns:
      hex-formatted string
    • compareTo

      default int compareTo(ByteArray o)

      For ByteArray this is a byte-by-byte, unsigned comparison.

      Specified by:
      compareTo in interface Comparable<ByteArray>
      Parameters:
      o -
      Returns:
    • toInteger

      static BigInteger toInteger(byte[] bytes)
      Utility to convert big-endian byte[] to integer
      Parameters:
      bytes - bytes
      Returns:
      integer representation of big-endian bytes