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

array of bytes #27

Closed
adesnos opened this issue Aug 28, 2012 · 1 comment
Closed

array of bytes #27

adesnos opened this issue Aug 28, 2012 · 1 comment

Comments

@adesnos
Copy link

adesnos commented Aug 28, 2012

I have a question, what is the best way to create an array of bytes ?

with a python list ?

In [1]: from jnius import autoclass

In [2]: byte_class = autoclass('java.lang.Byte')

In [3]: [byte_class(50), byte_class(60)]
Out[3]:
[<java.lang.Byte at 0x2296d70 jclass=java/lang/Byte jself=<jnius.LocalRef object at 0x19016e8>>,
<java.lang.Byte at 0x2296e30 jclass=java/lang/Byte jself=<jnius.LocalRef object at 0x1901698>>]

Thx !

@tito
Copy link
Member

tito commented Jul 2, 2013

An array of bytes is just an array of number limited to 255. Just create a list:

[100, 110, 105], and it will be accepted as byte arrays.

@tito tito closed this as completed Jul 2, 2013
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