diff options
| author | Jules Aguillon | 2024-01-01 21:04:54 +0100 |
|---|---|---|
| committer | Jules Aguillon | 2024-01-01 21:04:54 +0100 |
| commit | c524caa6f1d13e6bfb5f88d8a8c8512d23dd5294 (patch) | |
| tree | 98db5e107aeb174b73f39f1879cbeef0f3803326 /srcs/juloo.keyboard2/Utils.java | |
| parent | 7caf60c93b14e4feb5cabfce7db4655d607f0fee (diff) | |
| download | unexpected-keyboard-c524caa6f1d13e6bfb5f88d8a8c8512d23dd5294.tar.gz unexpected-keyboard-c524caa6f1d13e6bfb5f88d8a8c8512d23dd5294.zip | |
Remove unsupported API readAllBytes
Diffstat (limited to 'srcs/juloo.keyboard2/Utils.java')
| -rw-r--r-- | srcs/juloo.keyboard2/Utils.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/srcs/juloo.keyboard2/Utils.java b/srcs/juloo.keyboard2/Utils.java index cd28dfa..28bd9e3 100644 --- a/srcs/juloo.keyboard2/Utils.java +++ b/srcs/juloo.keyboard2/Utils.java @@ -4,6 +4,8 @@ import android.app.AlertDialog; import android.os.IBinder; import android.view.Window; import android.view.WindowManager; +import java.io.InputStream; +import java.io.InputStreamReader; class Utils { @@ -27,4 +29,16 @@ class Utils win.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM); dialog.show(); } + + public static String read_all_utf8(InputStream inp) throws Exception + { + InputStreamReader reader = new InputStreamReader(inp, "UTF-8"); + StringBuilder out = new StringBuilder(); + int buff_length = 8000; + char[] buff = new char[buff_length]; + int l; + while ((l = reader.read(buff, 0, buff_length)) != -1) + out.append(buff, 0, l); + return out.toString(); + } } |
