bbeaupain / nio_uring

High performance I/O library for Java using io_uring under the hood
MIT License
155 stars 11 forks source link

add support for Android ? #16

Closed TmacZhang closed 11 months ago

TmacZhang commented 11 months ago

I ported it to Android kernel5.15 and turned off selinux to ensure that there were no issues with the system call, but it still couldn't be used and there were no errors in the log

                try {
                    NativeLibraryLoader.load();
                    File file = new File(getContext().getCacheDir(), "testnio");
                    if (!file.exists()) {
                        file.createNewFile();
                    }
                    IoUringFile ioUringFile = new IoUringFile(file.getPath());
                    ioUringFile.onRead(in -> {
                        Log.i("jin1", "111 = "  +StandardCharsets.UTF_8.decode(in));
                        ioUringFile.close();
                    });
                    Log.i("jin1", "222 = "  );
                    new IoUring()
                            .queueRead(ioUringFile, ByteBuffer.allocateDirect(8192))
                            .execute();
                    String text = "Hello, World!";
                    Charset charset = Charset.forName("UTF-8");
                    ByteBuffer buffer = ByteBuffer.allocateDirect(text.length() * 4);
                    buffer.put(charset.encode(text));
                    buffer.flip();
                    new IoUring().queueWrite(ioUringFile, buffer).execute();
                } catch (Exception e) {
                }
TmacZhang commented 11 months ago

closed

bbeaupain commented 10 months ago

Were you able to resolve this?