Class S3Uri
- java.lang.Object
-
- software.amazon.awssdk.services.s3.S3Uri
-
- All Implemented Interfaces:
ToCopyableBuilder<S3Uri.Builder,S3Uri>
@Immutable public final class S3Uri extends Object implements ToCopyableBuilder<S3Uri.Builder,S3Uri>
Object that represents a parsed S3 URI. Can be used to easily retrieve the bucket, key, region, style, and query parameters of the URI. Only path-style and virtual-hosted-style URI parsing is supported, including CLI-style URIs, e.g., "s3://bucket/key". AccessPoints and Outposts URI parsing is not supported. If you work with object keys and/or query parameters with special characters, they must be URL-encoded, e.g., replace " " with "%20". If you work with virtual-hosted-style URIs with bucket names that contain a dot, i.e., ".", the dot must not be URL-encoded. Encoded buckets, keys, and query parameters will be returned decoded.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
S3Uri.Builder
A builder for creating aS3Uri
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<String>
bucket()
Returns the bucket specified in the URI.static S3Uri.Builder
builder()
boolean
equals(Object o)
Optional<String>
firstMatchingRawQueryParameter(String key)
Returns the value for the specified query parameter.List<String>
firstMatchingRawQueryParameters(String key)
Returns the list of values for a specified query parameter.int
hashCode()
boolean
isPathStyle()
Returns true if the URI is path-style, false if the URI is virtual-hosted style.Optional<String>
key()
Returns the key specified in the URI.Map<String,List<String>>
rawQueryParameters()
Returns a map of the query parameters specified in the URI.Optional<Region>
region()
Returns the region specified in the URI.S3Uri.Builder
toBuilder()
String
toString()
URI
uri()
Returns the original URI that was used to instantiate theS3Uri
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.utils.builder.ToCopyableBuilder
copy
-
-
-
-
Method Detail
-
builder
public static S3Uri.Builder builder()
-
toBuilder
public S3Uri.Builder toBuilder()
- Specified by:
toBuilder
in interfaceToCopyableBuilder<S3Uri.Builder,S3Uri>
-
bucket
public Optional<String> bucket()
Returns the bucket specified in the URI. Returns an empty optional if no bucket is specified.
-
key
public Optional<String> key()
Returns the key specified in the URI. Returns an empty optional if no key is specified.
-
region
public Optional<Region> region()
Returns the region specified in the URI. Returns an empty optional if no region is specified, i.e., global endpoint.
-
isPathStyle
public boolean isPathStyle()
Returns true if the URI is path-style, false if the URI is virtual-hosted style.
-
rawQueryParameters
public Map<String,List<String>> rawQueryParameters()
Returns a map of the query parameters specified in the URI. Returns an empty map if no queries are specified.
-
firstMatchingRawQueryParameters
public List<String> firstMatchingRawQueryParameters(String key)
Returns the list of values for a specified query parameter. A empty list is returned if the URI does not contain the specified query parameter.
-
firstMatchingRawQueryParameter
public Optional<String> firstMatchingRawQueryParameter(String key)
Returns the value for the specified query parameter. If there are multiple values for the query parameter, the first value is returned. An empty optional is returned if the URI does not contain the specified query parameter.
-
-