| 5 | import io.github.humbleui.skija.impl.*; |
| 6 | |
| 7 | public class ManagedString extends Managed { |
| 8 | static { Library.staticLoad(); } |
| 9 | |
| 10 | @ApiStatus.Internal |
| 11 | public ManagedString(long ptr) { |
| 12 | super(ptr, _FinalizerHolder.PTR); |
| 13 | } |
| 14 | |
| 15 | public ManagedString(@NotNull String s) { |
| 16 | this(_nMake(s)); |
| 17 | Stats.onNativeCall(); |
| 18 | } |
| 19 | |
| 20 | @Override |
| 21 | public String toString() { |
| 22 | try { |
| 23 | Stats.onNativeCall(); |
| 24 | return _nToString(_ptr); |
| 25 | } finally { |
| 26 | ReferenceUtil.reachabilityFence(this); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | @NotNull @Contract("-> this") |
| 31 | public ManagedString insert(int offset, @NotNull String s) { |
| 32 | assert s != null : "Can't insrert with s == null"; |
| 33 | Stats.onNativeCall(); |
| 34 | _nInsert(_ptr, offset, s); |
| 35 | return this; |
| 36 | } |
| 37 | |
| 38 | @NotNull @Contract("-> this") |
| 39 | public ManagedString append(@NotNull String s) { |
| 40 | assert s != null : "Can't append with s == null"; |
| 41 | Stats.onNativeCall(); |
| 42 | _nAppend(_ptr, s); |
| 43 | return this; |
| 44 | } |
| 45 | |
| 46 | @NotNull @Contract("-> this") |
| 47 | public ManagedString remove(int from) { |
| 48 | Stats.onNativeCall(); |
| 49 | _nRemoveSuffix(_ptr, from); |
| 50 | return this; |
| 51 | } |
| 52 | |
| 53 | @NotNull @Contract("-> this") |
| 54 | public ManagedString remove(int from, int length) { |
| 55 | Stats.onNativeCall(); |
| 56 | _nRemove(_ptr, from, length); |
| 57 | return this; |
| 58 | } |
| 59 | |
| 60 | @ApiStatus.Internal |
| 61 | public static class _FinalizerHolder { |
| 62 | public static final long PTR = _nGetFinalizer(); |
| 63 | } |
| 64 |
nothing calls this directly
no test coverage detected