I am working in Android. I need to convert byte[] to Buffer type. In Android, I have seen a type Buffered that I needed to use in particular functions. But, I my data source is type byte[].
Asked
Active
Viewed 1.9k times
1 Answers
33
Take a look at ByteBuffer.wrap:
byte[] bytes = ...;
Buffer buf = ByteBuffer.wrap(bytes);
There's also a ByteBuffer.wrap(byte[] array, int start, int byteCount)
if you only want to wrap part of an array.

Brendan Long
- 53,280
- 21
- 146
- 188