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

com.wavesplatform.common.utils.BaseXXEncDec.scala Maven / Gradle / Ivy

The newest version!
package com.wavesplatform.common.utils

import scala.util.Try

trait BaseXXEncDec {
  def defaultDecodeLimit: Int

  def encode(array: Array[Byte]): String
  def decode(str: String): Array[Byte]

  def tryDecode(str: String): Try[Array[Byte]] = Try {
    this.decode(str)
  }

  def tryDecodeWithLimit(str: String, limit: Int = defaultDecodeLimit): Try[Array[Byte]] =
    Try {
      require(str.length <= limit, s"base58Decode input exceeds $limit")
      this.tryDecode(str)
    }.flatten
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy