Package io.stargate.sgv2.api.common.util
Class ByteBufferUtils
java.lang.Object
io.stargate.sgv2.api.common.util.ByteBufferUtils
- Author:
- Dmitri Bourlatchkov
-
Method Summary
Modifier and TypeMethodDescriptionstatic ByteBufferfromBase64(String base64) static ByteBufferfromBase64UrlParam(String base64) static byte[]getArray(ByteBuffer bytes) Extract the content of the providedByteBufferas a byte array.static StringtoBase64(byte[] bytes) static StringtoBase64(ByteBuffer buffer) static StringtoBase64ForUrl(byte[] bytes) static StringtoBase64ForUrl(ByteBuffer buffer)
-
Method Details
-
toBase64
-
toBase64
-
fromBase64
-
toBase64ForUrl
-
toBase64ForUrl
-
fromBase64UrlParam
-
getArray
Extract the content of the providedByteBufferas a byte array.This method work with any type of
ByteBuffer(direct and non-direct ones), but when theByteBufferis backed by an array, this method will try to avoid copy when possible. As a consequence, changes to the returned byte array may or may not reflect into the initialByteBuffer.- Parameters:
bytes- the buffer whose content to extract.- Returns:
- a byte array with the content of
bytes. That array may be the array backingbytesif this can avoid a copy.
-