public class Util
extends java.lang.Object
| Constructor and Description |
|---|
Util() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.Map<java.lang.String,java.lang.Object> |
buildArchiveParams(java.util.Map options,
java.lang.String targetFormat) |
protected static java.lang.String |
buildCustomHeaders(java.lang.Object headers) |
protected static java.lang.String |
buildEager(java.util.List<? extends Transformation> transformations) |
static java.util.Map<java.lang.String,java.lang.Object> |
buildGenerateSpriteParams(java.util.Map options) |
static java.util.Map |
buildMultiParams(java.util.Map options) |
static java.util.Map<java.lang.String,java.lang.Object> |
buildUploadParams(java.util.Map options) |
static void |
clearEmpty(java.util.Map params) |
protected static java.lang.String |
encodeAccessControl(java.lang.Object accessControl) |
protected static java.lang.String |
encodeContext(java.lang.Object context) |
static byte[] |
getUTF8Bytes(java.lang.String string)
Encodes passed string value into a sequence of bytes using the UTF-8 charset.
|
static byte[] |
hash(java.lang.String input,
SignatureAlgorithm signatureAlgorithm)
Computes hash from input string using specified algorithm.
|
static void |
processWriteParameters(java.util.Map<java.lang.String,java.lang.Object> options,
java.util.Map<java.lang.String,java.lang.Object> params) |
static java.lang.String |
produceSignature(java.util.Map<java.lang.String,java.lang.Object> paramsToSign,
java.lang.String apiSecret)
Calculates signature, or hashed message authentication code (HMAC) of provided parameters name-value pairs and
secret value using default hashing algorithm (SHA1).
|
static java.lang.String |
produceSignature(java.util.Map<java.lang.String,java.lang.Object> paramsToSign,
java.lang.String apiSecret,
SignatureAlgorithm signatureAlgorithm)
Calculates signature, or hashed message authentication code (HMAC) of provided parameters name-value pairs and
secret value using specified hashing algorithm.
|
protected static java.lang.String |
timestamp() |
public static final java.util.Map<java.lang.String,java.lang.Object> buildUploadParams(java.util.Map options)
public static java.util.Map buildMultiParams(java.util.Map options)
public static java.util.Map<java.lang.String,java.lang.Object> buildGenerateSpriteParams(java.util.Map options)
protected static final java.lang.String buildEager(java.util.List<? extends Transformation> transformations)
public static final void processWriteParameters(java.util.Map<java.lang.String,java.lang.Object> options,
java.util.Map<java.lang.String,java.lang.Object> params)
protected static java.lang.String encodeAccessControl(java.lang.Object accessControl)
protected static java.lang.String encodeContext(java.lang.Object context)
protected static final java.lang.String buildCustomHeaders(java.lang.Object headers)
public static void clearEmpty(java.util.Map params)
public static final java.util.Map<java.lang.String,java.lang.Object> buildArchiveParams(java.util.Map options,
java.lang.String targetFormat)
protected static java.lang.String timestamp()
public static byte[] getUTF8Bytes(java.lang.String string)
string - string value to encodepublic static java.lang.String produceSignature(java.util.Map<java.lang.String,java.lang.Object> paramsToSign,
java.lang.String apiSecret)
Argument for hashing function is built by joining sorted parameter name-value pairs into single string in the same fashion as HTTP GET method uses, and concatenating the result with secret value in the end. Method supports arrays/collections as parameter values. In this case, the elements of array/collection are joined into single comma-delimited string prior to inclusion into the result.
paramsToSign - parameter name-value pairs list represented as instance of MapapiSecret - secret valuepublic static java.lang.String produceSignature(java.util.Map<java.lang.String,java.lang.Object> paramsToSign,
java.lang.String apiSecret,
SignatureAlgorithm signatureAlgorithm)
Argument for hashing function is built by joining sorted parameter name-value pairs into single string in the same fashion as HTTP GET method uses, and concatenating the result with secret value in the end. Method supports arrays/collections as parameter values. In this case, the elements of array/collection are joined into single comma-delimited string prior to inclusion into the result.
paramsToSign - parameter name-value pairs list represented as instance of MapapiSecret - secret valuesignatureAlgorithm - type of hashing algorithm to use for calculation of HMACpublic static byte[] hash(java.lang.String input,
SignatureAlgorithm signatureAlgorithm)
input - string which to compute hash fromsignatureAlgorithm - algorithm to use for computing hash