0

I want to encode double[] with Base64 or similar. For this I need to have byte[] how to convert/represent/cast double array to byte array with minimal copying?

I was considering to use ByteBuffer and DoubleBuffer but this will require copying.

Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
  • 3
    There is no way to do that without copying. – SLaks Aug 03 '14 at 22:10
  • If you have not done so already see if any answers to [base64 encoding in Java](http://stackoverflow.com/questions/13109588/base64-encoding-in-java) give you any ideas. – PM 77-1 Aug 03 '14 at 22:17

1 Answers1

0

Use a Base64OutputStream and write the bytes for your doubles out as you iterate over the array.

Brett Okken
  • 6,210
  • 1
  • 19
  • 25