List of usage examples for com.amazonaws.util Base64 encodeAsString
public static String encodeAsString(byte... bytes)
From source file:org.iternine.jeppetto.dao.dynamodb.iterable.DynamoDBIterable.java
License:Apache License
public String getPosition(boolean removeHashKey) { Map<String, AttributeValue> lastExaminedKey = getLastExaminedKey(removeHashKey); if (lastExaminedKey == null) { return null; }//from ww w . j a v a2s .c o m StringBuilder sb = new StringBuilder(); try { for (Map.Entry<String, AttributeValue> entry : lastExaminedKey.entrySet()) { if (sb.length() > 0) { sb.append("&"); } sb.append(entry.getKey()).append('=').append(encode(entry.getValue())); } return URLEncoder.encode(Base64.encodeAsString(sb.toString().getBytes()), StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); // Unexpected since UTF-8 is the system standard. } }
From source file:smartthings.brave.sqs.AmazonSQSRule.java
License:Apache License
private void sendSpansInternal(List<Span> spans) { String body = Base64.encodeAsString(SpanBytesEncoder.JSON_V2.encodeList(spans)); client.sendMessage(new SendMessageRequest(queueUrl, body)); }
From source file:zipkin.reporter.sqs.SQSSender.java
License:Apache License
@Override public Call<Void> sendSpans(List<byte[]> list) { if (closeCalled) throw new IllegalStateException("closed"); byte[] encodedSpans = BytesMessageEncoder.forEncoding(encoding()).encode(list); String body = encoding() == Encoding.JSON && isAscii(encodedSpans) ? new String(encodedSpans, UTF_8) : Base64.encodeAsString(encodedSpans); return new SQSCall(new SendMessageRequest(queueUrl(), body)); }