From 0c9242d429639bcfe208e15b9816426f5c1bc8e7 Mon Sep 17 00:00:00 2001 From: Charles Wu Date: Sun, 13 Dec 2020 23:32:25 +1100 Subject: [PATCH 1/2] add support of base64 in bufferbyte --- .../src/main/kotlin/io/github/wechaty/filebox/FileBox.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wechaty-puppet/src/main/kotlin/io/github/wechaty/filebox/FileBox.kt b/wechaty-puppet/src/main/kotlin/io/github/wechaty/filebox/FileBox.kt index 80dec61..98236a7 100644 --- a/wechaty-puppet/src/main/kotlin/io/github/wechaty/filebox/FileBox.kt +++ b/wechaty-puppet/src/main/kotlin/io/github/wechaty/filebox/FileBox.kt @@ -138,13 +138,13 @@ class FileBox(options: FileBoxOptions) { } fun toJsonString(): String { - buffer = toByte(this) + buffer = getBufferByte(this) return JsonUtils.write(this) } - fun toByte(fileBox: FileBox): ByteArray? { + fun getBufferByte(fileBox: FileBox): ByteArray? { when (fileBox.type()) { FileBoxType.File -> { @@ -153,11 +153,12 @@ class FileBox(options: FileBoxOptions) { return FileUtils.readFileToByteArray(file) } - FileBoxType.Url -> { return null; } - + FileBoxType.Base64 -> { + return null; + } else -> { TODO() } From 63f5d8d22d0f2d8348148e2a627c669b145e0665 Mon Sep 17 00:00:00 2001 From: Charles Wu Date: Mon, 14 Dec 2020 21:01:05 +1100 Subject: [PATCH 2/2] change method to private --- .../src/main/kotlin/io/github/wechaty/filebox/FileBox.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wechaty-puppet/src/main/kotlin/io/github/wechaty/filebox/FileBox.kt b/wechaty-puppet/src/main/kotlin/io/github/wechaty/filebox/FileBox.kt index 98236a7..5e3b9f4 100644 --- a/wechaty-puppet/src/main/kotlin/io/github/wechaty/filebox/FileBox.kt +++ b/wechaty-puppet/src/main/kotlin/io/github/wechaty/filebox/FileBox.kt @@ -144,7 +144,7 @@ class FileBox(options: FileBoxOptions) { } - fun getBufferByte(fileBox: FileBox): ByteArray? { + private fun getBufferByte(fileBox: FileBox): ByteArray? { when (fileBox.type()) { FileBoxType.File -> {