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

com.wavesenterprise.utils.Base64.scala Maven / Gradle / Ivy

There is a newer version: 1.16.0
Show newest version
package com.wavesenterprise.utils

import scala.util.Try

object Base64 {
  def encode(input: Array[Byte]): String = new String(java.util.Base64.getEncoder.encode(input))

  def decode(input: String): Try[Array[Byte]] = Try {
    val str = if (input.startsWith("base64:")) input.substring(7) else input
    java.util.Base64.getDecoder.decode(str)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy