Forum: JRuby JRuby and nio.ByteBuffer

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Paul F. (Guest)
on 2009-04-09 18:46
(Received via mailing list)
How to handle java.nio.ByteBuffer in JRuby?

buffer = ByteBuffer.allocate(1024)
buffer.array  # gives us a java array but can we end up with a ruby
array?

"from_java" technique does not seem to be available.

Thanks
Paul F.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Thomas E Enebo (Guest)
on 2009-04-09 20:00
(Received via mailing list)
buffer.array.to_a will give you an array with the contents of the
buffer, although it will construct a new array...which may not be what
you want?

-Tom

On Thu, Apr 9, 2009 at 9:44 AM, Paul F. <removed_email_address@domain.invalid> 
wrote:
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>



--
Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: removed_email_address@domain.invalid , 
removed_email_address@domain.invalid

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
Charles Oliver N. (Guest)
on 2009-04-09 21:49
(Received via mailing list)
You probably want String.from_java_bytes(buffer.array).

- Charlie

Thomas E Enebo wrote:
>> buffer.array  # gives us a java array but can we end up with a ruby array?
>>
>>
>>
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
This topic is locked and can not be replied to.