private ExecutionContext(final Builder builder) { this.requestHandler2s = builder.requestHandler2s; this.awsRequestMetrics = builder.useRequestMetrics ? new AWSRequestMetricsFullSupport() : new AWSRequestMetrics(); this.awsClient = builder.awsClient; this.signerProvider = builder.signerProvider; }
/** * Returns a base 32 encoded string of the given bytes. */ public static String encodeAsString(byte ... bytes) { if (bytes == null) return null; return bytes.length == 0 ? "" : CodecUtils.toStringDirect(codec.encode(bytes)); }
/** * Returns the MD5 in base64 for the given file. */ public static String md5AsBase64(File file) throws FileNotFoundException, IOException { return Base64.encodeAsString(computeMD5Hash(file)); } }
public static Date parseRfc822Date(String dateString) { if (StringUtils.isNullOrEmpty(dateString)) { return null; } return DateUtils.parseRFC822Date(dateString); }
/** * Adds the specified value as Base64 encoded text to the current position of the in * progress XML document. * * @param b * The binary data to add to the XML document. * * @return This XMLWriter so that additional method calls can be chained * together. */ public XMLWriter value(ByteBuffer b) { append(escapeXMLEntities(Base64.encodeAsString(BinaryUtils.copyBytesFrom(b)))); return this; }
/** * Base64 encodes the data in the specified byte buffer (from the current * position to the buffer's limit) and returns it as a base64 encoded * string. * * @param byteBuffer * The data to base64 encode and return as a string; must not be * null. * * @return The base64 encoded contents of the specified byte buffer. */ public static String fromByteBuffer(ByteBuffer byteBuffer) { return Base64.encodeAsString(copyBytesFrom(byteBuffer)); }
@Override public String toString() { return Base64.encodeAsString(value); } }
public RetryRule(int maxRetryAttempts, long delay, TimeUnit timeUnit) { this.maxRetryAttempts = maxRetryAttempts; this.delay = delay; this.timeUnit = ValidationUtils.assertNotNull(timeUnit, "timeUnit"); }
/** * Returns a base 16 encoded string (in lower case) of the given bytes. */ public static String encodeAsString(byte ... bytes) { if (bytes == null) return null; return bytes.length == 0 ? "" : CodecUtils.toStringDirect(codec.encode(bytes)); }
/** * This constructor should be used only in the case when AWS SDK metrics * collector is disabled, when minimal timing info is supported for backward * compatibility reasons. * * @see AWSRequestMetricsFullSupport */ public AWSRequestMetrics() { this.timingInfo = TimingInfo.startTiming(); }
public EqualJitterBackoffStrategy(final int baseDelay, final int maxBackoffTime) { this.baseDelay = ValidationUtils.assertIsPositive(baseDelay, "Base delay"); this.maxBackoffTime = ValidationUtils.assertIsPositive(maxBackoffTime, "Max backoff"); }
/** Fluent API of {@link #incrementCounter(String)} */ public final AWSRequestMetrics incrementCounterWith(String event) { incrementCounter(event); return this; } /** Fluent API of {@link #incrementCounter(MetricType)} */
public JavaVersion(final Integer majorVersionFamily, final Integer majorVersion, final Integer maintenanceNumber, final Integer updateNumber) { this.majorVersionFamily = majorVersionFamily; this.majorVersion = majorVersion; this.maintenanceNumber = maintenanceNumber; this.updateNumber = updateNumber; this.knownVersion = KnownJavaVersions.fromMajorVersion(majorVersionFamily, majorVersion); this.tokenizedVersion = this.getTokenizedVersion(); }
/** * Get the public key. Only available if supplied at instance launch time. */ public static String getPublicKey() { return fetchData(EC2_METADATA_ROOT + "/public-keys/0/openssh-key"); }
/** * Override the default header timestamp format for input type because we have always marshalled header value as ISO_8601, changing it to * rfc822 might break existing customers who are relying on that behavior. If not configured, we set it to UNKNOWN and let HeaderMarshallers.DATE * to set the default format. */ @Override protected String defaultHeaderTimestamp() { return TimestampFormat.UNKNOWN.getFormat(); }
/** * Converts a Hex-encoded data string to the original byte data. * * @param hexData * hex-encoded data to decode. * @return decoded data from the hex string. */ public static byte[] fromHex(String hexData) { return Base16Lower.decode(hexData); }
/** * Returns the MD5 in base64 for the data from the given input stream. * Note this method closes the given input stream upon completion. */ public static String md5AsBase64(InputStream is) throws IOException { return Base64.encodeAsString(computeMD5Hash(is)); }
/** * Returns a base 16 encoded string (in upper case) of the given bytes. */ public static String encodeAsString(byte ... bytes) { if (bytes == null) return null; return bytes.length == 0 ? "" : CodecUtils.toStringDirect(codec.encode(bytes)); }
/** * Returns the MD5 in base64 for the given byte array. */ public static String md5AsBase64(byte[] input) { return Base64.encodeAsString(computeMD5Hash(input)); }