| 6 | import org.jetbrains.skija.impl.*; |
| 7 | |
| 8 | public class ManagedString extends Managed { |
| 9 | static { Library.staticLoad(); } |
| 10 | |
| 11 | @ApiStatus.Internal |
| 12 | public ManagedString(long ptr) { |
| 13 | super(ptr, _FinalizerHolder.PTR); |
| 14 | } |
| 15 | |
| 16 | public ManagedString(String s) { |
| 17 | this(_nMake(s)); |
| 18 | Stats.onNativeCall(); |
| 19 | } |
| 20 | |
| 21 | @Override |
| 22 | public String toString() { |
| 23 | try { |
| 24 | Stats.onNativeCall(); |
| 25 | return _nToString(_ptr); |
| 26 | } finally { |
| 27 | Reference.reachabilityFence(this); |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | @NotNull @Contract("-> this") |
| 32 | public ManagedString insert(int offset, @NotNull String s) { |
| 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 | Stats.onNativeCall(); |
| 41 | _nAppend(_ptr, s); |
| 42 | return this; |
| 43 | } |
| 44 | |
| 45 | @NotNull @Contract("-> this") |
| 46 | public ManagedString remove(int from) { |
| 47 | Stats.onNativeCall(); |
| 48 | _nRemoveSuffix(_ptr, from); |
| 49 | return this; |
| 50 | } |
| 51 | |
| 52 | @NotNull @Contract("-> this") |
| 53 | public ManagedString remove(int from, int length) { |
| 54 | Stats.onNativeCall(); |
| 55 | _nRemove(_ptr, from, length); |
| 56 | return this; |
| 57 | } |
| 58 | |
| 59 | @ApiStatus.Internal |
| 60 | public static class _FinalizerHolder { |
| 61 | public static final long PTR = _nGetFinalizer(); |
| 62 | } |
| 63 | |
| 64 | @ApiStatus.Internal public static native long _nMake(String s); |
| 65 | @ApiStatus.Internal public static native long _nGetFinalizer(); |
nothing calls this directly
no test coverage detected