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.
63b8056f715d4bc8c1415c97613360f4?d=identicon&s=25 Paul Fraser (Guest)
on 2009-04-09 16: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 Fraser

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

    http://xircles.codehaus.org/manage_email
13313ac2ec7ba7c43b1b952db034ff3b?d=identicon&s=25 Thomas E Enebo (Guest)
on 2009-04-09 18: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 Fraser <paulf@a2zliving.com> wrote:
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>



--
Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: enebo@acm.org , tom.enebo@gmail.com

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

    http://xircles.codehaus.org/manage_email
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2009-04-09 19: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.