public final class ByteHelpers extends Object
Modifier and Type | Method and Description |
---|---|
static com.google.protobuf.ByteString |
buteBufferToByteString(ByteBuffer buffer)
Converts a
ByteBuffer to a ByteString . |
static byte[] |
byteBufferToArray(ByteBuffer buffer)
Converts a
ByteBuffer instance to a plain byte array. |
public static byte[] byteBufferToArray(ByteBuffer buffer)
ByteBuffer
instance to a plain byte array. This method
respects whether the buffer is read-only or has an underlying array
available. In cases where an array is present and can be accessed, this
array will be returned. Otherwise a copy is created.buffer
- the buffer to convertpublic static com.google.protobuf.ByteString buteBufferToByteString(ByteBuffer buffer)
ByteBuffer
to a ByteString
.buffer
- buffer to convertByteString
instance with the same contents. Might be
coupled to the passed in ByteBuffer
and reflect changes
on that buffer.Copyright © 2018 CoR-Lab. All rights reserved.