BytesRef bytesRef = new BytesRef(sb);
return Base64.encodeBytes(bytesRef.bytes, bytesRef.offset, bytesRef.length, Base64.URL_SAFE);
}
public static ParsedScrollId parseScrollId(String scrollId) {
CharsRefBuilder spare = new CharsRefBuilder();
try {
byte[] decode = Base64.decode(scrollId, Base64.URL_SAFE);
spare.copyUTF8Bytes(decode, 0, decode.length);
} catch (Exception e) {
throw new ElasticsearchIllegalArgumentException("Failed to decode scrollId", e);
}
String[] elements = Strings.splitStringToArray(spare.get(), ';');
if (elements.length < 2) {
throw new ElasticsearchIllegalArgumentException("Malformed scrollId [" + scrollId + "]");
}
int index = 0;