|
|
@ -25,8 +25,9 @@ object EncoderUtils { |
|
|
|
return tmp.toString() |
|
|
|
return tmp.toString() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fun base64Decode(str: String): String { |
|
|
|
@JvmOverloads |
|
|
|
val bytes = Base64.decode(str, Base64.DEFAULT) |
|
|
|
fun base64Decode(str: String, flags: Int = Base64.DEFAULT): String { |
|
|
|
|
|
|
|
val bytes = Base64.decode(str, flags) |
|
|
|
return try { |
|
|
|
return try { |
|
|
|
String(bytes, StandardCharsets.UTF_8) |
|
|
|
String(bytes, StandardCharsets.UTF_8) |
|
|
|
} catch (e: Exception) { |
|
|
|
} catch (e: Exception) { |
|
|
@ -34,6 +35,7 @@ object EncoderUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@JvmOverloads |
|
|
|
fun base64Encode(str: String, flags: Int = Base64.NO_WRAP): String? { |
|
|
|
fun base64Encode(str: String, flags: Int = Base64.NO_WRAP): String? { |
|
|
|
return Base64.encodeToString(str.toByteArray(), flags) |
|
|
|
return Base64.encodeToString(str.toByteArray(), flags) |
|
|
|
} |
|
|
|
} |
|
|
|