public final class CloudFileDirectory extends Object implements ListFileItem
Directories, which are encapsulated as CloudFileDirectories objects, hold files and can also contain
sub-directories.
| Modifier | Constructor and Description |
|---|---|
|
CloudFileDirectory(StorageUri directoryAbsoluteUri,
CloudFileClient client)
Creates an instance of the
CloudFileDirectory class using an absolute URI to the directory. |
protected |
CloudFileDirectory(StorageUri uri,
String directoryName,
CloudFileShare share)
Creates an instance of the
CloudFileDirectory class using the specified address, share,
and client. |
|
CloudFileDirectory(URI directoryAbsoluteUri,
CloudFileClient client)
Creates an instance of the
CloudFileDirectory class using an absolute URI to the directory. |
| 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. |
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.
|
CloudFileDirectory |
getSubDirectoryReference(String itemName)
Deprecated.
as of 2.0.0. Use
#getDirectoryReference() instead. |
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.
|
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.
|
protected void |
setProperties(FileDirectoryProperties properties)
Sets the properties for the directory.
|
protected void |
setShare(CloudFileShare share)
Sets the share for the directory.
|
protected void |
setStorageUri(StorageUri storageUri)
Sets the list of URIs for all locations.
|
public CloudFileDirectory(URI directoryAbsoluteUri, CloudFileClient client) throws StorageException, URISyntaxException
CloudFileDirectory class using an absolute URI to the directory.directoryAbsoluteUri - A URI that represents the file directory's address.client - A CloudFileClient object that represents the associated service client.StorageExceptionURISyntaxExceptionpublic CloudFileDirectory(StorageUri directoryAbsoluteUri, CloudFileClient client) throws StorageException, URISyntaxException
CloudFileDirectory class using an absolute URI to the directory.directoryAbsoluteUri - A StorageUri that represents the file directory's address.client - A CloudFileClient object that represents the associated service client.StorageExceptionURISyntaxExceptionprotected CloudFileDirectory(StorageUri uri, String directoryName, CloudFileShare share)
CloudFileDirectory class using the specified address, share,
and client.uri - A StorageUri that represents the file directory's address.directoryName - A String that represents the name of the directory.share - A CloudFileShare object that represents the associated file share.@DoesServiceRequest public void create() throws StorageException
StorageException - If a storage service error occurred.@DoesServiceRequest public void create(FileRequestOptions options, OperationContext opContext) throws StorageException
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 boolean createIfNotExists() throws StorageException
true if the directory did not already exist and was created; otherwise, false.StorageException - If a storage service error occurred.@DoesServiceRequest public boolean createIfNotExists(FileRequestOptions options, OperationContext opContext) throws StorageException
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.@DoesServiceRequest public void delete() throws StorageException
StorageException - If a storage service error occurred.@DoesServiceRequest public void delete(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 boolean deleteIfExists() throws StorageException
true if the directory did not already exist and was created; otherwise, false.StorageException - If a storage service error occurred.@DoesServiceRequest public boolean deleteIfExists(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.true if the directory existed and was deleted; otherwise, false.StorageException - If a storage service error occurred.@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 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.StorageException - If a storage service error occurred.URISyntaxException - If the resource URI is invalid.@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.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@Deprecated public CloudFileDirectory getSubDirectoryReference(String itemName) throws URISyntaxException, StorageException
#getDirectoryReference() instead.CloudFileDirectory object that represents a subdirectory in this directory.itemName - A String that represents the name of the subdirectory.CloudFileDirectory object that represents a reference to the specified directory.URISyntaxException - If the resource URI is invalid.StorageExceptionpublic URI getUri()
getUri in interface ListFileItemjava.net.URI object that represents the URI for this directory.public final StorageUri getStorageUri()
getStorageUri in interface ListFileItemStorageUri 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 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 ListFileItemCloudFileDirectory object that represents the parent directory associated with the directory.StorageExceptionURISyntaxExceptionpublic CloudFileShare getShare() throws StorageException, URISyntaxException
getShare in interface ListFileItemCloudFileShare that represents the share for this directory.StorageException - If a storage service error occurred.URISyntaxException - If the resource URI is invalid.protected final void setShare(CloudFileShare share)
share - A CloudFileShare object that represents the share being assigned to the directory.protected final void setProperties(FileDirectoryProperties properties)
properties - A FileDirectoryProperties object that represents the properties being assigned to the
directory.protected void setStorageUri(StorageUri storageUri)
storageUri - A StorageUri that represents the list of URIs for all locations./**
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/