public class ListObjectsRequest extends AmazonWebServiceRequest implements WormMirrorDestinationProvider, Serializable
Contains options to return a list of summary information about the objects in the specified bucket. Depending on the request parameters, additional information is returned, such as common prefixes if a delimiter was specified. List results are always returned in lexicographic (alphabetical) order.
Buckets can contain a virtually unlimited number of keys, and the complete
results of a list query can be extremely large. To manage large result sets,
Amazon S3 uses pagination to split them into multiple responses.
Always check the ObjectListing.isTruncated()
method to see
if the returned listing is complete, or if callers need to make additional
calls to get more results. Alternatively, use the
AmazonS3Client.listNextBatchOfObjects(ObjectListing)
method as an
easy way to get the next page of object listings.
Calling ListObjectsRequest.setDelimiter(String)
sets the delimiter, allowing groups of keys that share the
delimiter-terminated prefix to be included
in the returned listing. This allows applications to organize and browse
their keys hierarchically, similar to how a file system organizes files
into directories. These common prefixes can be retrieved
through the ObjectListing.getCommonPrefixes()
method.
For example, consider a bucket that contains the following keys:
listObjects
with
a prefix value of "foo/" and a delimiter value of "/"
on this bucket, an ObjectListing
is returned that contains one key
("foo/boo") and one entry in the common prefixes list ("foo/bar/").
To see deeper into the virtual hierarchy, make another
call to listObjects
setting the prefix parameter to any interesting
common prefix to list the individual keys under that prefix.
The total number of keys in a bucket doesn't substantially affect list performance, nor does the presence or absence of additional request parameters.
NOOP
Constructor and Description |
---|
ListObjectsRequest()
Constructs a new
ListObjectsRequest object. |
ListObjectsRequest(String bucketName,
String prefix,
String marker,
String delimiter,
Integer maxKeys)
Constructs a new
ListObjectsRequest object and
initializes all required and optional object fields. |
Modifier and Type | Method and Description |
---|---|
String |
getBucketName()
The name of the bucket containing the objects.
|
String |
getDelimiter()
Gets the optional delimiter parameter that causes keys that contain
the same string between the prefix and the first occurrence of the
delimiter to be combined into a single result element in the
ObjectListing.getCommonPrefixes() list. |
String |
getEncodingType()
Gets the optional
encodingType parameter indicating the
encoding method to be applied on the response. |
String |
getMarker()
Gets the optional marker parameter indicating where in the bucket to begin
listing.
|
Integer |
getMaxKeys()
Gets the optional
maxKeys parameter indicating the maximum number of keys to
include in the response. |
String |
getPrefix()
Gets the optional prefix parameter and restricts the response to keys
that begin with the specified prefix.
|
String |
getWormMirrorDestination()
Returns the optional mirror-destination value for WORM mirroring
|
void |
setBucketName(String bucketName)
The name of the bucket containing the objects.
|
void |
setDelimiter(String delimiter)
Sets the optional delimiter parameter that causes keys that contain the
same string between the prefix and the first occurrence of the delimiter
to be combined into a single result element in the
ObjectListing.getCommonPrefixes() list. |
void |
setEncodingType(String encodingType)
Sets the optional
encodingType parameter indicating the
encoding method to be applied on the response. |
void |
setMarker(String marker)
Sets the optional marker parameter indicating where in the bucket to begin
listing.
|
void |
setMaxKeys(Integer maxKeys)
Sets the optional
maxKeys parameter indicating the maximum number of keys to
include in the response. |
void |
setPrefix(String prefix)
Sets the optional prefix parameter, restricting the response to keys that
begin with the specified prefix.
|
void |
setWormMirrorDestination(String wormMirrorDestination)
Sets the optional mirror-destination value for WORM mirroring
|
ListObjectsRequest |
withBucketName(String bucketName)
The name of the bucket containing the objects.
|
ListObjectsRequest |
withDelimiter(String delimiter)
Sets the optional delimiter parameter that causes keys that contain the
same string between the prefix and the first occurrence of the delimiter
to be rolled up into a single result element in the
ObjectListing.getCommonPrefixes() list. |
ListObjectsRequest |
withEncodingType(String encodingType)
Sets the optional
encodingType parameter indicating the
encoding method to be applied on the response. |
ListObjectsRequest |
withMarker(String marker)
Sets the optional marker parameter indicating where in the bucket to begin
listing.
|
ListObjectsRequest |
withMaxKeys(Integer maxKeys)
Sets the optional
maxKeys parameter indicating the maximum number of keys to
include in the response. |
ListObjectsRequest |
withPrefix(String prefix)
Sets the optional prefix parameter restricting the response to keys that
begin with the specified prefix.
|
ListObjectsRequest |
withWormMirrorDestination(String wormMirrorDestination)
Sets the optional mirror-destination value for WORM mirroring
and returns the updated ListObjectsRequest so that additional
method calls may be chained together.
|
addHandlerContext, clone, copyBaseTo, getCloneRoot, getCloneSource, getCustomQueryParameters, getCustomRequestHeaders, getGeneralProgressListener, getHandlerContext, getReadLimit, getRequestClientOptions, getRequestCredentials, getRequestCredentialsProvider, getRequestMetricCollector, getSdkClientExecutionTimeout, getSdkRequestTimeout, putCustomQueryParameter, putCustomRequestHeader, setGeneralProgressListener, setRequestCredentials, setRequestCredentialsProvider, setRequestMetricCollector, setSdkClientExecutionTimeout, setSdkRequestTimeout, withGeneralProgressListener, withRequestCredentialsProvider, withRequestMetricCollector, withSdkClientExecutionTimeout, withSdkRequestTimeout
public ListObjectsRequest()
ListObjectsRequest
object.
The caller must populate
the object fields before the request is ready to be executed.public ListObjectsRequest(String bucketName, String prefix, String marker, String delimiter, Integer maxKeys)
ListObjectsRequest
object and
initializes all required and optional object fields.
When using this action with an access point, you must direct requests to the access point hostname. The
access point hostname takes the form
AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action
with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the
bucket name. For more information about access point ARNs, see Using access points
in the Amazon S3 User Guide.
When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The
S3 on Outposts hostname takes the form
AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts in the
Amazon S3 User Guide.
bucketName
- The name of the bucket, or access point ARN, whose objects are to be listed.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts
hostname. The S3 on Outposts hostname takes the form
AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts
in the Amazon S3 User Guide.
prefix
- The prefix restricting what keys will be listed.marker
- The key marker indicating where listing results should begin.delimiter
- The delimiter for condensing common prefixes in the returned
listing results.maxKeys
- The maximum number of results to return.ListObjectsRequest()
public String getBucketName()
The name of the bucket containing the objects.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The
S3 on Outposts hostname takes the form
AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts in the
Amazon S3 User Guide.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts
hostname. The S3 on Outposts hostname takes the form
AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts
in the Amazon S3 User Guide.
ListObjectsRequest.setBucketName(String)
,
ListObjectsRequest.withBucketName(String)
public void setBucketName(String bucketName)
The name of the bucket containing the objects.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The
S3 on Outposts hostname takes the form
AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts in the
Amazon S3 User Guide.
bucketName
- The name of the bucket containing the objects.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts
hostname. The S3 on Outposts hostname takes the form
AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts
in the Amazon S3 User Guide.
ListObjectsRequest.getBucketName()
,
ListObjectsRequest.withBucketName(String)
public ListObjectsRequest withBucketName(String bucketName)
The name of the bucket containing the objects.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The
S3 on Outposts hostname takes the form
AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts in the
Amazon S3 User Guide.
bucketName
- The name of the bucket containing the objects.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When you use this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts
hostname. The S3 on Outposts hostname takes the form
AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com
.
When you use this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts
access point ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see What is S3 on Outposts
in the Amazon S3 User Guide.
ListObjectsRequest
, enabling additional method
calls to be chained together.ListObjectsRequest.getBucketName()
,
ListObjectsRequest.setBucketName(String)
public String getPrefix()
ListObjectsRequest.setPrefix(String)
public void setPrefix(String prefix)
prefix
- The optional prefix parameter, restricting the response to keys
that begin with the specified prefix.ListObjectsRequest.getPrefix()
public ListObjectsRequest withPrefix(String prefix)
ListObjectsRequest
, enabling additional method
calls to be chained together.prefix
- The optional prefix parameter restricting the response to keys
that begin with the specified prefix.ListObjectsRequest
, enabling additional method
calls to be chained together.ListObjectsRequest.getPrefix()
,
ListObjectsRequest.setPrefix(String)
public String getMarker()
ListObjectsRequest.setMarker(String)
,
ListObjectsRequest.withMarker(String)
public void setMarker(String marker)
marker
- The optional marker parameter indicating where in the bucket to begin
listing. The list will only include keys that occur
lexicographically after the marker.ListObjectsRequest.getMarker()
,
ListObjectsRequest.withMarker(String)
public ListObjectsRequest withMarker(String marker)
ListObjectsRequest
, enabling additional method
calls to be chained together.
The list will only include keys that occur lexicographically
after the marker.marker
- The optional parameter indicating where in the bucket to begin
listing. The list will only include keys that occur
lexicographically after the marker.ListObjectsRequest
, enabling additional method
calls to be chained together.ListObjectsRequest.getMarker()
,
ListObjectsRequest.setMarker(String)
public String getDelimiter()
ObjectListing.getCommonPrefixes()
list. These combined keys
are not returned elsewhere in the response. The most commonly used
delimiter is "/", which simulates a hierarchical organization similar to
a file system directory structure.ObjectListing.getCommonPrefixes()
list.ListObjectsRequest.setDelimiter(String)
,
ListObjectsRequest.withDelimiter(String)
public void setDelimiter(String delimiter)
ObjectListing.getCommonPrefixes()
list.delimiter
- The optional delimiter parameter that causes keys that contain
the same string between the prefix and the first occurrence of
the delimiter to be combined into a single result element in
the ObjectListing.getCommonPrefixes()
list.ListObjectsRequest.getDelimiter()
,
ListObjectsRequest.withDelimiter(String)
public ListObjectsRequest withDelimiter(String delimiter)
ObjectListing.getCommonPrefixes()
list.
Returns this ListObjectsRequest
, enabling additional method
calls to be chained together.delimiter
- The optional delimiter parameter that causes keys that contain
the same string between the prefix and the first occurrence of
the delimiter to be rolled up into a single result element in
the ObjectListing.getCommonPrefixes()
list.ListObjectsRequest
, enabling additional method
calls to be chained together.ListObjectsRequest.getDelimiter()
,
ListObjectsRequest.setDelimiter(String)
public Integer getMaxKeys()
maxKeys
parameter indicating the maximum number of keys to
include in the response. Amazon S3 might return fewer keys than specified, but will
never return more. Even if the optional parameter is not specified,
Amazon S3 will limit the number of results in the response.ListObjectsRequest.setMaxKeys(Integer)
,
ListObjectsRequest.withMaxKeys(Integer)
public void setMaxKeys(Integer maxKeys)
maxKeys
parameter indicating the maximum number of keys to
include in the response.maxKeys
- The optional parameter indicating the maximum number of keys
to include in the response.ListObjectsRequest.getMaxKeys()
,
ListObjectsRequest.withMaxKeys(Integer)
public ListObjectsRequest withMaxKeys(Integer maxKeys)
maxKeys
parameter indicating the maximum number of keys to
include in the response.
Returns this ListObjectsRequest
, enabling additional method
calls to be chained together.maxKeys
- The optional parameter indicating the maximum number of keys
to include in the response.ListObjectsRequest
, enabling additional method
calls to be chained together.ListObjectsRequest.getMaxKeys()
,
ListObjectsRequest.setMaxKeys(Integer)
public String getEncodingType()
encodingType
parameter indicating the
encoding method to be applied on the response.public void setEncodingType(String encodingType)
encodingType
parameter indicating the
encoding method to be applied on the response. An object key can contain
any Unicode character; however, XML 1.0 parser cannot parse some
characters, such as characters with an ASCII value from 0 to 10. For
characters that are not supported in XML 1.0, you can add this parameter
to request that Amazon S3 encode the keys in the response.encodingType
- The encoding method to be applied on the response. Valid
values: null (not encoded) or "url".public ListObjectsRequest withEncodingType(String encodingType)
encodingType
parameter indicating the
encoding method to be applied on the response. An object key can contain
any Unicode character; however, XML 1.0 parser cannot parse some
characters, such as characters with an ASCII value from 0 to 10. For
characters that are not supported in XML 1.0, you can add this parameter
to request that Amazon S3 encode the keys in the response.
Returns this ListObjectsRequest
, enabling additional method calls
to be chained together.encodingType
- The encoding method to be applied on the response. Valid
values: null (not encoded) or "url".public String getWormMirrorDestination()
getWormMirrorDestination
in interface WormMirrorDestinationProvider
public void setWormMirrorDestination(String wormMirrorDestination)
setWormMirrorDestination
in interface WormMirrorDestinationProvider
wormMirrorDestination
- The optional mirror-destination value for WORM mirroringpublic ListObjectsRequest withWormMirrorDestination(String wormMirrorDestination)
wormMirrorDestination
- The optional mirror-destination value for WORM mirroringListObjectsRequest
, enabling additional method
calls to be chained together.Copyright © 2024. All rights reserved.