com.blr19c.falowp.bot.system.image.Base64.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of falowp-bot-system Show documentation
Show all versions of falowp-bot-system Show documentation
FalowpBot system infrastructure
package com.blr19c.falowp.bot.system.image
import java.awt.image.BufferedImage
import java.io.ByteArrayInputStream
import java.util.*
import javax.imageio.ImageIO
fun ByteArray.encodeToBase64String(): String = Base64.getEncoder().encodeToString(this)
fun String.decodeFromBase64String(): ByteArray = Base64.getDecoder().decode(this)
fun String.base64ToBufferedImage(): BufferedImage = ImageIO.read(ByteArrayInputStream(this.decodeFromBase64String()))