(Tag tag)
| 286 | } |
| 287 | |
| 288 | public us.bpsm.edn.printer.Printer.Fn<?> serializeFromSerializable(Tag tag) { |
| 289 | return (o, writer) -> { |
| 290 | try { |
| 291 | ByteArrayOutputStream baos = new ByteArrayOutputStream(); |
| 292 | ObjectOutputStream oos = new ObjectOutputStream(baos); |
| 293 | oos.writeObject(o); |
| 294 | oos.close(); |
| 295 | byte[] bytes = baos.toByteArray(); |
| 296 | |
| 297 | byte[] b2 = Base64.getEncoder() |
| 298 | .encode(bytes); |
| 299 | |
| 300 | String v = new String(b2); |
| 301 | |
| 302 | Map<Object, Object> mm = new LinkedHashMap<>(); |
| 303 | |
| 304 | mm.put(Keyword.newKeyword("base64"), v); |
| 305 | |
| 306 | writer.printValue(tag) |
| 307 | .printValue(mm); |
| 308 | |
| 309 | } catch (IOException e) { |
| 310 | e.printStackTrace(); |
| 311 | } |
| 312 | }; |
| 313 | } |
| 314 | |
| 315 | // public us.bpsm.edn.printer.Printer.Fn<?> serializeToToString(Tag tag) { |
| 316 | // return (o, writer) -> { |
no test coverage detected