Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Newline driven approach #8

Open
stefanlechner opened this issue Mar 30, 2020 · 1 comment
Open

Newline driven approach #8

stefanlechner opened this issue Mar 30, 2020 · 1 comment

Comments

@stefanlechner
Copy link
Contributor

After debugging a while, I figured out, that the communication is hard newline driven.

            synchronized(inputStream) {
                try {
                    val receivedString = **reader.readLine()**
                    if (!TextUtils.isEmpty(receivedString)) {
                        emitter.onNext(receivedString)
                    }
                } catch (e: Exception) {
                    if (!emitter.isCancelled && !closed.get()) {
                        emitter.onError(e)
                    }
                }

My communication requries a # or \r\n as delimiter.
There are several ways to solve this, the easiest and most flexibility providing solution, seems to me, changing from reader.readLine() to a scanner with a regex.
Are you interested in a modification like this ?

@harryjph
Copy link
Owner

harryjph commented Apr 4, 2020

The problem is that I haven't released the current master branch, which contains a fix for this problem: a method to directly access the OutputStream so you can handle input however you like. I will try to get this release out, I didn't release it as I didn't get enough of a chance to test it...

If you would like to use this now, try using the master branch snapshot release from JitPack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants