public final class CloudFileDirectory extends Object implements ListFileItem
Directories, which are encapsulated as CloudFileDirectory
objects, hold files and can also contain
sub-directories.
Constructor and Description |
---|
CloudFileDirectory(StorageUri directoryAbsoluteUri)
Creates an instance of the
CloudFileDirectory class using an absolute URI to the directory. |
CloudFileDirectory(StorageUri directoryAbsoluteUri,
StorageCredentials credentials)
Creates an instance of the
CloudFileDirectory class using an absolute URI to the directory
and credentials. |
CloudFileDirectory(URI directoryAbsoluteUri)
Creates an instance of the
CloudFileDirectory class using an absolute URI to the directory. |
CloudFileDirectory(URI directoryAbsoluteUri,
StorageCredentials credentials)
Creates an instance of the
CloudFileDirectory class using an absolute URI to the directory
and credentials. |
Modifier and Type | Method and Description |
---|---|
void |
create()
Creates the directory.
|
void |
create(FileRequestOptions options,
OperationContext opContext)
Creates the directory using the specified options and operation context.
|
boolean |
createIfNotExists()
Creates the directory if it does not exist.
|
boolean |
createIfNotExists(FileRequestOptions options,
OperationContext opContext)
Creates the directory if it does not exist, using the specified request options and operation context.
|
void |
delete()
Deletes the directory.
|
void |
delete(AccessCondition accessCondition,
FileRequestOptions options,
OperationContext opContext)
Deletes the directory using the specified request options and operation context.
|
boolean |
deleteIfExists()
Deletes the directory if it exists.
|
boolean |
deleteIfExists(AccessCondition accessCondition,
FileRequestOptions options,
OperationContext opContext)
Deletes the directory if it exists using the specified request options and operation context.
|
void |
downloadAttributes()
Downloads the directory's properties.
|
void |
downloadAttributes(AccessCondition accessCondition,
FileRequestOptions options,
OperationContext opContext)
Downloads the directory's properties using the specified request options and operation context.
|
boolean |
exists()
Returns a value that indicates whether the directory exists.
|
boolean |
exists(AccessCondition accessCondition,
FileRequestOptions options,
OperationContext opContext)
Returns a value that indicates whether the directory exists, using the specified request options and operation
context.
|
CloudFileDirectory |
getDirectoryReference(String itemName)
Returns a reference to a
CloudFileDirectory object that represents a directory in this directory. |
CloudFile |
getFileReference(String fileName)
Returns a reference to a
CloudFile object that represents a file in this directory. |
HashMap<String,String> |
getMetadata()
Returns the metadata for the directory.
|
String |
getName()
Returns the name of this directory.
|
CloudFileDirectory |
getParent()
Returns the
CloudFileDirectory parent directory associated with this directory. |
FileDirectoryProperties |
getProperties()
Returns the
FileDirectoryProperties object that holds the directory's system properties. |
CloudFileClient |
getServiceClient()
Returns the File service client associated with this directory.
|
CloudFileShare |
getShare()
Returns the share for this directory.
|
StorageUri |
getStorageUri()
Returns the list of URIs for all locations.
|
URI |
getUri()
Returns the URI for this directory.
|
Iterable<ListFileItem> |
listFilesAndDirectories()
Returns an enumerable collection of file and directory items for the directory.
|
Iterable<ListFileItem> |
listFilesAndDirectories(FileRequestOptions options,
OperationContext opContext)
Returns an enumerable collection of file and directory items for the directory.
|
Iterable<ListFileItem> |
listFilesAndDirectories(String prefix,
FileRequestOptions options,
OperationContext opContext)
Returns an enumerable collection of file and directory items for the directory.
|
ResultSegment<ListFileItem> |
listFilesAndDirectoriesSegmented()
Returns a result segment of an enumerable collection of files and directories for this File service client.
|
ResultSegment<ListFileItem> |
listFilesAndDirectoriesSegmented(Integer maxResults,
ResultContinuation continuationToken,
FileRequestOptions options,
OperationContext opContext)
Returns a result segment of an enumerable collection of files and directories for this directory, using the
specified listing details options, request options, and operation context.
|
ResultSegment<ListFileItem> |
listFilesAndDirectoriesSegmented(String prefix,
Integer maxResults,
ResultContinuation continuationToken,
FileRequestOptions options,
OperationContext opContext)
Returns a result segment of an enumerable collection of files and directories for this directory, using the
specified listing details options, request options, and operation context.
|
void |
setMetadata(HashMap<String,String> metadata)
Sets the metadata collection of name-value pairs to be set on the directory with an
uploadMetadata() call. |
void |
uploadMetadata()
Uploads the directory's metadata.
|
void |
uploadMetadata(AccessCondition accessCondition,
FileRequestOptions options,
OperationContext opContext)
Uploads the directory's metadata using the specified request options and operation context.
|
public CloudFileDirectory(URI directoryAbsoluteUri) throws StorageException, URISyntaxException
CloudFileDirectory
class using an absolute URI to the directory.directoryAbsoluteUri
- A URI
that represents the file directory's address.StorageException
URISyntaxException
public CloudFileDirectory(StorageUri directoryAbsoluteUri) throws StorageException, URISyntaxException
CloudFileDirectory
class using an absolute URI to the directory.directoryAbsoluteUri
- A StorageUri
that represents the file directory's address.StorageException
URISyntaxException
public CloudFileDirectory(URI directoryAbsoluteUri, StorageCredentials credentials) throws StorageException, URISyntaxException
CloudFileDirectory
class using an absolute URI to the directory
and credentials.directoryAbsoluteUri
- A URI
that represents the file directory's address.credentials
- A StorageCredentials
object used to authenticate access.StorageException
URISyntaxException
public CloudFileDirectory(StorageUri directoryAbsoluteUri, StorageCredentials credentials) throws StorageException, URISyntaxException
CloudFileDirectory
class using an absolute URI to the directory
and credentials.directoryAbsoluteUri
- A StorageUri
that represents the file directory's address.credentials
- A StorageCredentials
object used to authenticate access.StorageException
URISyntaxException
@DoesServiceRequest public void create() throws StorageException, URISyntaxException
StorageException
- If a storage service error occurred.URISyntaxException
@DoesServiceRequest public void create(FileRequestOptions options, OperationContext opContext) throws StorageException, URISyntaxException
options
- A FileRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudFileClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException
- If a storage service error occurred.URISyntaxException
@DoesServiceRequest public boolean createIfNotExists() throws StorageException, URISyntaxException
true
if the directory did not already exist and was created; otherwise, false
.StorageException
- If a storage service error occurred.URISyntaxException
@DoesServiceRequest public boolean createIfNotExists(FileRequestOptions options, OperationContext opContext) throws StorageException, URISyntaxException
options
- A FileRequestOptions
object that specifies any additional options for the request.
Specifying null
will use the default request options from the associated service client
(CloudFileClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.true
if the directory did not already exist and was created; otherwise, false
.StorageException
- If a storage service error occurred.URISyntaxException
@DoesServiceRequest public void delete() throws StorageException, URISyntaxException
StorageException
- If a storage service error occurred.URISyntaxException
@DoesServiceRequest public void delete(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException, URISyntaxException
accessCondition
- An AccessCondition
object that represents the access conditions for the directory.options
- A FileRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudFileClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException
- If a storage service error occurred.URISyntaxException
@DoesServiceRequest public boolean deleteIfExists() throws StorageException, URISyntaxException
true
if the directory did not already exist and was created; otherwise, false
.StorageException
- If a storage service error occurred.URISyntaxException
@DoesServiceRequest public boolean deleteIfExists(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException, URISyntaxException
accessCondition
- An AccessCondition
object that represents the access conditions for the directory.options
- A FileRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudFileClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.true
if the directory existed and was deleted; otherwise, false
.StorageException
- If a storage service error occurred.URISyntaxException
@DoesServiceRequest public boolean exists() throws StorageException
true
if the directory exists, otherwise false
.StorageException
- If a storage service error occurred.@DoesServiceRequest public boolean exists(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException
accessCondition
- An AccessCondition
object that represents the access conditions for the share.options
- A FileRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudFileClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.true
if the directory exists, otherwise false
.StorageException
- If a storage service error occurred.@DoesServiceRequest public void uploadMetadata() throws StorageException, URISyntaxException
StorageException
- If a storage service error occurred.URISyntaxException
@DoesServiceRequest public void uploadMetadata(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException, URISyntaxException
accessCondition
- An AccessCondition
object that represents the access conditions for the directory.options
- A FileRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudFileClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException
- If a storage service error occurred.URISyntaxException
@DoesServiceRequest public void downloadAttributes() throws StorageException
StorageException
- If a storage service error occurred.@DoesServiceRequest public void downloadAttributes(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException
accessCondition
- An AccessCondition
object that represents the access conditions for the directory.options
- A FileRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudFileClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.StorageException
- If a storage service error occurred.@DoesServiceRequest public Iterable<ListFileItem> listFilesAndDirectories()
ListFileItem
objects that represent the file and directory items in
this directory.@DoesServiceRequest public Iterable<ListFileItem> listFilesAndDirectories(FileRequestOptions options, OperationContext opContext)
options
- A FileRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudFileClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.ListFileItem
objects that represent the file and directory items in
this directory.@DoesServiceRequest public Iterable<ListFileItem> listFilesAndDirectories(String prefix, FileRequestOptions options, OperationContext opContext)
prefix
- A string containing the file or directory name prefix.options
- A FileRequestOptions
object that specifies any additional options for the request. Specifying
null
will use the default request options from the associated service client (
CloudFileClient
).opContext
- An OperationContext
object that represents the context for the current operation. This object
is used to track requests to the storage service, and to provide additional runtime information about
the operation.ListFileItem
objects that represent the file and directory items in
this directory.@DoesServiceRequest public ResultSegment<ListFileItem> listFilesAndDirectoriesSegmented() throws StorageException
ResultSegment
object that contains a segment of the enumerable collection of
ListFileItem
objects that represent the files and directories.StorageException
@DoesServiceRequest public ResultSegment<ListFileItem> listFilesAndDirectoriesSegmented(Integer maxResults, ResultContinuation continuationToken, FileRequestOptions options, OperationContext opContext) throws StorageException
maxResults
- The maximum number of results to retrieve. If null
or greater
than 5000, the server will return up to 5,000 items. Must be at least 1.continuationToken
- A ResultContinuation
object that represents a continuation token
returned by a previous listing operation.options
- A FileRequestOptions
object that specifies any additional options for
the request. Specifying null
will use the default request options
from the associated service client ( CloudFileClient
).opContext
- An OperationContext
object that represents the context for the current
operation. This object is used to track requests to the storage service,
and to provide additional runtime information about the operation.ResultSegment
object that contains a segment of the enumerable collection of
ListFileItem
objects that represent the files and directories in this directory.StorageException
- If a storage service error occurred.@DoesServiceRequest public ResultSegment<ListFileItem> listFilesAndDirectoriesSegmented(String prefix, Integer maxResults, ResultContinuation continuationToken, FileRequestOptions options, OperationContext opContext) throws StorageException
prefix
- A string containing the file or directory name prefix.maxResults
- The maximum number of results to retrieve. If null
or greater
than 5000, the server will return up to 5,000 items. Must be at least 1.continuationToken
- A ResultContinuation
object that represents a continuation token
returned by a previous listing operation.options
- A FileRequestOptions
object that specifies any additional options for
the request. Specifying null
will use the default request options
from the associated service client ( CloudFileClient
).opContext
- An OperationContext
object that represents the context for the current
operation. This object is used to track requests to the storage service,
and to provide additional runtime information about the operation.ResultSegment
object that contains a segment of the enumerable collection of
ListFileItem
objects that represent the files and directories in this directory.StorageException
- If a storage service error occurred.public CloudFile getFileReference(String fileName) throws URISyntaxException, StorageException
CloudFile
object that represents a file in this directory.fileName
- A String
that represents the name of the file.CloudFile
object that represents a reference to the specified file.StorageException
- If a storage service error occurred.URISyntaxException
- If the resource URI is invalid.public CloudFileDirectory getDirectoryReference(String itemName) throws URISyntaxException, StorageException
CloudFileDirectory
object that represents a directory in this directory.itemName
- A String
that represents the name of the directory.CloudFileDirectory
object that represents a reference to the specified directory.URISyntaxException
- If the resource URI is invalid.StorageException
public URI getUri()
getUri
in interface ListFileItem
java.net.URI
object that represents the URI for this directory.public final StorageUri getStorageUri()
getStorageUri
in interface ListFileItem
StorageUri
that represents the list of URIs for all locations.public CloudFileClient getServiceClient()
CloudFileClient
object that represents the service client associated with the directory.public String getName()
String
that represents the name of the directory.public HashMap<String,String> getMetadata()
downloadAttributes()
, and is set on the directory with a call to uploadMetadata()
.java.util.HashMap
object that represents the metadata for the directory.public FileDirectoryProperties getProperties()
FileDirectoryProperties
object that holds the directory's system properties.FileDirectoryProperties
object that holds the system properties associated with the
directory.public CloudFileDirectory getParent() throws URISyntaxException, StorageException
CloudFileDirectory
parent directory associated with this directory.getParent
in interface ListFileItem
CloudFileDirectory
object that represents the parent directory associated with the directory.StorageException
URISyntaxException
public CloudFileShare getShare() throws StorageException, URISyntaxException
getShare
in interface ListFileItem
CloudFileShare
that represents the share for this directory.StorageException
- If a storage service error occurred.URISyntaxException
- If the resource URI is invalid.public void setMetadata(HashMap<String,String> metadata)
uploadMetadata()
call.
This collection will overwrite any existing directory metadata. If this is set to an empty collection, the
directory metadata will be cleared on an uploadMetadata()
call.metadata
- A java.util.HashMap
object that represents the metadata being assigned to the directory.Copyright © 2018. All Rights Reserved.