public final class Util extends Object
Modifier and Type | Method and Description |
---|---|
static String |
canonicalMetadataKey(String meta) |
static HttpURLConnection |
createHttpConnection(URL endpointUrl,
String httpMethod,
Map<String,String> headers,
int connectTimeoutMs,
int readTimeoutMs) |
static InputStream |
emptyInputStream() |
static Optional<String> |
jsonFieldText(String json,
String fieldName) |
static byte[] |
readBytesAndClose(InputStream in) |
static byte[] |
sha256(byte[] data) |
static byte[] |
sha256(String text)
Hashes the string contents (assumed to be UTF-8) using the SHA-256 algorithm.
|
static String |
toHex(byte[] data)
Converts byte data to a Hex-encoded string.
|
static URL |
toUrl(String url) |
static String |
urlEncode(String url,
boolean keepPathSlash) |
public static HttpURLConnection createHttpConnection(URL endpointUrl, String httpMethod, Map<String,String> headers, int connectTimeoutMs, int readTimeoutMs) throws IOException
IOException
public static String toHex(byte[] data)
data
- data to hex encode.public static byte[] sha256(String text)
public static byte[] sha256(byte[] data)
public static byte[] readBytesAndClose(InputStream in)
public static final InputStream emptyInputStream()
Copyright © 2021–2024. All rights reserved.