question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Avoiding `Binary` format to be based on byte buffers

See original GitHub issue

Just a small side-line note: I do not think it is a good idea to bind the Binary format onto ByteBuffers. Frameworks such as Netty are explicitly built around avoiding ByteBuffer usage as they can be rather performance heavy and uses its own ByteBuf abstraction. It would be of advantage to hooking any form of byte-cosumer / byte-producer into this API.

Also, I do not think that the average user would want to write a binary format to a buffer but rather to a stream. And even when using NIO, I cannot see how an implementor of the API could push or poll bytes asynchronously since the implementation needs to block on the tracer’s inject and extract methods. I therefore think that Binary should rather be some form of callback carrier such as an input or output stream what are at least interfaces that can delegate to a byte byffer if needed without any practical performance impact.

Finally, for the current API, it is not clear to me how the return values of binary are supposed to be used. A ByteBuffer already has internal offsets which are altered during read/write. This only opens a possibility for inconsistencies.

Thanks for clarifying and considering my suggestion.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:62 (25 by maintainers)

github_iconTop GitHub Comments

4reactions
raphwcommented, Jan 12, 2018

No worries. I love complaining.

2reactions
tedsuocommented, Jan 11, 2018

That sounds correct, @carlosalberto.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inserting unsigned integer value into bytebuffer, maintaining ...
I'm trying to put the following binary representation into a bytebuffer for 4 bytes. But since Java doesn't do unsigned, I'm having trouble: ......
Read more >
ByteBuffer (Java Platform SE 7 ) - Oracle Help Center
A byte buffer. This class defines six categories of operations upon byte buffers: Absolute and relative get and put methods that read and...
Read more >
Guide to ByteBuffer - Baeldung
A quick and practical guide to ByteBuffers. ... The Buffer classes are the foundation upon which Java NIO is built.
Read more >
Byte Buffers and Non-Heap Memory - kdgregory.com
Foremost among them is that the in-memory layout of instance data is explicitly not defined. Code like obj.seqNum does not translate to pointer ......
Read more >
Working with binary data - the Tcler's Wiki!
Various data formats and communication protocols employ binary data. ... characters uses multiple bytes. binary scan creates a byte array ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found