We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 830b8b9 commit 0125326Copy full SHA for 0125326
jvm/src/test/scala/scala/xml/JavaByteSerialization.scala
@@ -1,6 +1,7 @@
1
package scala.xml
2
3
import java.io._
4
+import java.util.Base64
5
6
object JavaByteSerialization {
7
def roundTrip[T](obj: T): T = {
@@ -20,4 +21,12 @@ object JavaByteSerialization {
20
21
val ois = new ObjectInputStream(bis)
22
ois.readObject.asInstanceOf[T]
23
}
24
+
25
+ def base64Encode[T](in: T): String = {
26
+ Base64.getEncoder.encodeToString(serialize[T](in))
27
+ }
28
29
+ def base64Decode[T](in: String): T = {
30
+ deserialize[T](Base64.getDecoder.decode(in))
31
32
0 commit comments