(@NotNull Throwable ex)
| 73 | } |
| 74 | |
| 75 | public static @NotNull String stacktrace(@NotNull Throwable ex) { |
| 76 | try (var out = new ByteArrayOutputStream(); |
| 77 | var ps = new PrintStream(out, false, StandardCharsets.UTF_8)) { |
| 78 | ex.printStackTrace(ps); |
| 79 | return out.toString(StandardCharsets.UTF_8); |
| 80 | } catch (IOException e) { |
| 81 | throw Task.forceThrow(e); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | public static @NotNull String fromBinary(@NotNull Binary b) { |
| 86 | return new String(b.bytesUnsafe(), b.getOffset(), b.size(), StandardCharsets.UTF_8); |