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

expose method to create parser from direct memory #435

Open
wants to merge 1 commit into
base: develop
from

Conversation

@arnaudroger
Copy link

@arnaudroger arnaudroger commented Oct 10, 2017

Useful to parse message coming in from netty for example without creating a lot of garbage.
Also expose the method to create a parser from a sub array.

@xerial xerial requested a review from komamitsu Oct 21, 2017
@xerial
Copy link
Member

@xerial xerial commented Oct 21, 2017

@komamitsu Could you review this change? This seems a good improvement.

Copy link
Member

@komamitsu komamitsu left a comment

@arnaudroger Thanks for the contribution! It seems a cool feature.

But I have some questions. Can I ask you to take a look at them?

* @param address the address
* @param offset the offset
* @param length the length
* @return a new ByteBufferInput on the specified address

This comment has been minimized.

@komamitsu

komamitsu Oct 21, 2017
Member

This static method returns ByteBuffer not ByteBufferInput

*/
public static ByteBuffer directBuffer(long address, int offset, int length)
{
return DirectBufferAccess.newByteBuffer(address, offset, length, null);

This comment has been minimized.

@komamitsu

komamitsu Oct 21, 2017
Member

It doesn't seem to me that this method is related to ByteBufferInput.

@xerial Do you think this is the right place to put the method in?

This comment has been minimized.

@xerial

xerial Nov 29, 2017
Member

We can make DirectBufferAccess a public class instead of adding this method.

This comment has been minimized.

@xerial

xerial Nov 29, 2017
Member

Actually this location is a bit weird.

return _createParser(data, offset, length, ioContext);
}

public JsonParser createParser(long memoryAddress, int offset, int length)

This comment has been minimized.

@komamitsu

komamitsu Oct 21, 2017
Member

As you might notice since this method doesn't have @Override annotation, Jackson doesn't support this kind of API, I think.

How do you use this method via Jackson's API? It would be great, if you add some unit tests to make it clear 😺

This comment has been minimized.

@arnaudroger

arnaudroger Oct 21, 2017
Author

I use the MessagePackFactory directly, currently using reflection.

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

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.