mengdiwang / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

new methods to store/retive a long from byte array #478

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

The com.google.common.primitives.Longs class has a methods
long fromByteArray(byte[] bytes) and byte[] toByteArray(long value), They are 
probably cover most of the use cases. Nevertheless in our application we need to
store and retrieve a long value from staring from some offset. With the 
attached patch I added such functionality. If it's looks reasonable to you I 
can update Ints class as well. The patch against r142 is attached.

Thanks,
   Tigran.

Original issue reported on code.google.com by kofem...@gmail.com on 17 Nov 2010 at 9:04

Attachments:

GoogleCodeExporter commented 9 years ago
Whenever you need something more than what from/toByteArray do, you should 
simply use a ByteBuffer or LongBuffer; it's exactly what it's there for.

Original comment by kevinb@google.com on 19 Nov 2010 at 2:47

GoogleCodeExporter commented 9 years ago
Issue 1056 has been merged into this issue.

Original comment by wasserman.louis on 4 Jul 2012 at 5:07

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:15

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:09