Skip to content

Instantly share code, notes, and snippets.

@blinsay
Created October 29, 2014 23:41
Show Gist options
  • Save blinsay/9a5ea651aeebd6375fd0 to your computer and use it in GitHub Desktop.
Save blinsay/9a5ea651aeebd6375fd0 to your computer and use it in GitHub Desktop.
[16] pry(main)> def write_bytes_to_stream(thing)
[16] pry(main)* bs = ByteArrayOutputStream.new(1024)
[16] pry(main)* bs.java_send :write, [Java::int], thing
[16] pry(main)* bs.close
[16] pry(main)* bs.to_byte_array
[16] pry(main)* end
=> nil
[20] pry(main)> write_bytes_to_stream(1024)
=> byte[0]@6ad3381f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment