public final class Utility extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
STORAGE_TRACING_NAMESPACE_VALUE |
| Constructor and Description |
|---|
Utility() |
| Modifier and Type | Method and Description |
|---|---|
static String |
appendQueryParameter(String url,
String key,
String value)
Appends a query parameter to a url.
|
static Flux<ByteBuffer> |
convertStreamToByteBuffer(InputStream data,
long length,
int blockSize)
A utility method for converting the input stream to Flux of ByteBuffer.
|
static Flux<ByteBuffer> |
convertStreamToByteBuffer(InputStream data,
long length,
int blockSize,
boolean markAndReset)
A utility method for converting the input stream to Flux of ByteBuffer.
|
static String |
encodeUrlPath(String url)
Performs a safe encoding of a url string, only encoding the path.
|
static OffsetDateTime |
parseDate(String dateString)
Given a String representing a date in a form of the ISO8601 pattern, generates a Date representing it with up to
millisecond precision.
|
static String |
urlDecode(String stringToDecode)
Performs a safe decoding of the passed string, taking care to preserve each
+ character rather than
replacing it with a space character. |
static String |
urlEncode(String stringToEncode)
Performs a safe encoding of the specified string, taking care to insert %20 for each space character instead of
inserting the
+ character. |
public static final String STORAGE_TRACING_NAMESPACE_VALUE
public static String urlDecode(String stringToDecode)
+ character rather than
replacing it with a space character.stringToDecode - String value to decodeRuntimeException - If the UTF-8 charset isn't supportedpublic static String urlEncode(String stringToEncode)
+ character.stringToEncode - String value to encodeRuntimeException - If the UTF-8 charset ins't supportedpublic static String encodeUrlPath(String url)
url - The url to encode.public static OffsetDateTime parseDate(String dateString)
dateString - the String to be interpreted as a DateDate objectIllegalArgumentException - If dateString doesn't match an ISO8601 patternpublic static Flux<ByteBuffer> convertStreamToByteBuffer(InputStream data, long length, int blockSize)
data - The input data which needs to convert to ByteBuffer.length - The expected input data length.blockSize - The size of each ByteBuffer.ByteBuffer which contains the input data.com.azure.core.exception.UnexpectedLengthException - when input data length mismatch input length.RuntimeException - When I/O error occurs.public static Flux<ByteBuffer> convertStreamToByteBuffer(InputStream data, long length, int blockSize, boolean markAndReset)
data - The input data which needs to convert to ByteBuffer.length - The expected input data length.blockSize - The size of each ByteBuffer.markAndReset - Whether the stream needs to be marked and reset. This should generally always be true to
support retries. It is false in the case of buffered upload to support non markable streams because buffered
upload uses its own mechanisms to support retries.ByteBuffer which contains the input data.com.azure.core.exception.UnexpectedLengthException - when input data length mismatch input length.RuntimeException - When I/O error occurs.Copyright © 2021 Microsoft Corporation. All rights reserved.