ShareDirectoryClient Class
Definition
- java.lang.Object
- com.azure.storage.file.share.ShareDirectoryClient
This class provides a client that contains all the operations for interacting with directory in Azure Storage File Service. Operations allowed by the client are creating, deleting and listing subdirectory and file, retrieving properties, setting metadata and list or force close handles of the directory or file.
Instantiating an Synchronous Directory Client
ShareDirectoryClient client = new ShareFileClientBuilder()
.connectionString("${connectionString}")
.endpoint("${endpoint}")
.buildDirectoryClient();
View ShareFileClientBuilder for additional ways to construct the client.
public class ShareDirectoryClient
Methods
| create() |
Creates a directory in the file share and returns a response of ShareDirectoryInfo to interact with it. Code Samples Create the directory
For more information, see the Azure Docs. |
| createFile(String fileName, long maxSize) |
Creates a file in this directory with specific name, max number of results and returns a response of ShareDirectoryInfo to interact with it. Code Samples Create 1k file with named "myFile"
For more information, see the Azure Docs. |
| createFileWithResponse(String fileName, long maxSize, ShareFileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map<String,String> metadata, ShareRequestConditions requestConditions, Duration timeout, Context context) |
Creates a file in this directory with specific name and returns a response of ShareDirectoryInfo to interact with it. Code Samples Create the file named "myFile"
For more information, see the Azure Docs. |
| createFileWithResponse(String fileName, long maxSize, ShareFileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map<String,String> metadata, Duration timeout, Context context) |
Creates a file in this directory with specific name and returns a response of ShareDirectoryInfo to interact with it. Code Samples Create the file named "myFile"
For more information, see the Azure Docs. |
| createSubdirectory(String subdirectoryName) |
Creates a subdirectory under current directory with specific name and returns a response of ShareDirectoryClient to interact with it. Code Samples Create the sub directory "subdir"
For more information, see the Azure Docs. |
| createSubdirectoryWithResponse(String subdirectoryName, FileSmbProperties smbProperties, String filePermission, Map<String,String> metadata, Duration timeout, Context context) |
Creates a subdirectory under current directory with specific name , metadata and returns a response of ShareDirectoryClient to interact with it. Code Samples Create the subdirectory named "subdir", with metadata
For more information, see the Azure Docs. |
| createWithResponse(FileSmbProperties smbProperties, String filePermission, Map<String,String> metadata, Duration timeout, Context context) |
Creates a directory in the file share and returns a response of ShareDirectoryInfo to interact with it. Code Samples Create the directory
For more information, see the Azure Docs. |
| delete() |
Deletes the directory in the file share. The directory must be empty before it can be deleted. Code Samples Delete the directory
For more information, see the Azure Docs. |
| deleteFile(String fileName) |
Deletes the file with specific name in this directory. Code Samples Delete the file "filetest"
For more information, see the Azure Docs. |
| deleteFileWithResponse(String fileName, ShareRequestConditions requestConditions, Duration timeout, Context context) |
Deletes the file with specific name in this directory. Code Samples Delete the file "filetest"
For more information, see the Azure Docs. |
| deleteFileWithResponse(String fileName, Duration timeout, Context context) |
Deletes the file with specific name in this directory. Code Samples Delete the file "filetest"
For more information, see the Azure Docs. |
| deleteSubdirectory(String subdirectoryName) |
Deletes the subdirectory with specific name in this directory. The directory must be empty before it can be deleted. Code Samples Delete the subdirectory named "subdir"
For more information, see the Azure Docs. |
| deleteSubdirectoryWithResponse(String subdirectoryName, Duration timeout, Context context) |
Deletes the subdirectory with specific name in this directory. The directory must be empty before it can be deleted. Code Samples Delete the subdirectory named "subdir"
For more information, see the Azure Docs. |
| deleteWithResponse(Duration timeout, Context context) |
Deletes the directory in the file share. The directory must be empty before it can be deleted. Code Samples Delete the directory
For more information, see the Azure Docs. |
| exists() |
Determines if the directory this client represents exists in the cloud. Code Samples
|
| existsWithResponse(Duration timeout, Context context) |
Determines if the directory this client represents exists in the cloud. Code Samples
|
| forceCloseAllHandles(boolean recursive, Duration timeout, Context context) |
Closes all handles opened on the directory at the service. Code Samples Force close all handles recursively.
For more information, see the Azure Docs. |
| forceCloseHandle(String handleId) |
Closes a handle on the directory at the service. This is intended to be used alongside listHandles(Integer maxResultsPerPage, boolean recursive, Duration timeout, Context context). Code Samples Force close handles returned by list handles.
For more information, see the Azure Docs. |
| forceCloseHandleWithResponse(String handleId, Duration timeout, Context context) |
Closes a handle on the directory at the service. This is intended to be used alongside listHandles(Integer maxResultsPerPage, boolean recursive, Duration timeout, Context context). Code Samples Force close handles returned by list handles.
For more information, see the Azure Docs. |
| generateSas(ShareServiceSasSignatureValues shareServiceSasSignatureValues) |
Generates a service SAS for the directory using the specified ShareServiceSasSignatureValues Note : The client must be authenticated via StorageSharedKeyCredential See ShareServiceSasSignatureValues for more information on how to construct a service SAS. Code Samples
|
| generateSas(ShareServiceSasSignatureValues shareServiceSasSignatureValues, Context context) |
Generates a service SAS for the directory using the specified ShareServiceSasSignatureValues Note : The client must be authenticated via StorageSharedKeyCredential See ShareServiceSasSignatureValues for more information on how to construct a service SAS. Code Samples
|
| getAccountName() |
Get associated account name. |
| getDirectoryPath() |
Get the directory path of the client. Get directory path.
|
| getDirectoryUrl() |
Get the url of the storage directory client. |
| getFileClient(String fileName) |
Constructs a ShareFileClient that interacts with the specified file. If the file doesn't exist in this directory create(long maxSize) create} in the client will need to be called before interaction with the file can happen. |
| getHttpPipeline() |
Gets the HttpPipeline powering this client. |
| getProperties() |
Retrieves the properties of this directory. The properties includes directory metadata, last modified date, is server encrypted, and eTag. Code Samples Retrieve directory properties
For more information, see the Azure Docs. |
| getPropertiesWithResponse(Duration timeout, Context context) |
Retrieves the properties of this directory. The properties includes directory metadata, last modified date, is server encrypted, and eTag. Code Samples Retrieve directory properties
For more information, see the Azure Docs. |
| getServiceVersion() |
Gets the service version the client is using. |
| getShareName() |
Get the share name of directory client. Get the share name.
|
| getShareSnapshotId() |
Get snapshot id which attached to ShareDirectoryClient. Return Code Samples Get the share snapshot id.
|
| getSubdirectoryClient(String subdirectoryName) |
Constructs a ShareDirectoryClient that interacts with the specified directory. If the file doesn't exist in this directory create() create} in the client will need to be called before interaction with the directory can happen. |
| listFilesAndDirectories() |
Lists all sub-directories and files in this directory without their prefix or maxResult in single page. Code Samples List all sub-directories and files in the account
For more information, see the Azure Docs. |
| listFilesAndDirectories(ShareListFilesAndDirectoriesOptions options, Duration timeout, Context context) |
Lists all sub-directories and files in this directory with their prefix or snapshots. Code Samples List all sub-directories and files in this directory with "subdir" prefix and return 10 results in the account
For more information, see the Azure Docs. |
| listFilesAndDirectories(String prefix, Integer maxResultsPerPage, Duration timeout, Context context) |
Lists all sub-directories and files in this directory with their prefix or snapshots. Code Samples List all sub-directories and files in this directory with "subdir" prefix and return 10 results in the account
For more information, see the Azure Docs. |
| listHandles(Integer maxResultsPerPage, boolean recursive, Duration timeout, Context context) |
List of open handles on a directory or a file. Code Samples Get 10 handles with recursive call.
For more information, see the Azure Docs. |
| rename(String destinationPath) |
Moves the directory to another location within the share. For more information see the Azure Docs. Code Samples
|
| renameWithResponse(ShareFileRenameOptions options, Duration timeout, Context context) |
Moves the directory to another location within the share. For more information see the Azure Docs. Code Samples
|
| setMetadata(Map<String,String> metadata) |
Sets the user-defined metadata to associate to the directory. If Code Samples Set the metadata to "directory:updatedMetadata"
Clear the metadata of the directory
For more information, see the Azure Docs. |
| setMetadataWithResponse(Map<String,String> metadata, Duration timeout, Context context) |
Sets the user-defined metadata to associate to the directory. If Code Samples Set the metadata to "directory:updatedMetadata"
Clear the metadata of the directory
For more information, see the Azure Docs. |
| setProperties(FileSmbProperties smbProperties, String filePermission) |
Sets the properties of this directory. The properties include the file SMB properties and the file permission. Code Samples Set directory properties
For more information, see the Azure Docs. |
| setPropertiesWithResponse(FileSmbProperties smbProperties, String filePermission, Duration timeout, Context context) |
Sets the properties of this directory. The properties include the file SMB properties and the file permission. Code Samples Set directory properties
For more information, see the Azure Docs. |