ByteHelpers¶
-
public final class
ByteHelpers¶ A class with helper methods to convert different byte array representations.
- Author
jwienke
Methods¶
buteBufferToByteString¶
-
public static ByteString
buteBufferToByteString(ByteBuffer buffer)¶ Converts a
ByteBufferto aByteString.- Parameters
buffer – buffer to convert
- Returns
ByteStringinstance with the same contents. Might be coupled to the passed inByteBufferand reflect changes on that buffer.
byteBufferToArray¶
-
public static byte[]
byteBufferToArray(ByteBuffer buffer)¶ Converts a
ByteBufferinstance 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.- Parameters
buffer – the buffer to convert
- Returns
array with contents of the buffer. Should not be modified usually