/** * Returns a reference to a {@link CloudFileDirectory} object that represents a subdirectory in * this directory. * * @param itemName A <code>String</code> that represents the name of the subdirectory. * @return A {@link CloudFileDirectory} object that represents a reference to the specified * directory. * @throws URISyntaxException If the resource URI is invalid. * @throws StorageException */ public CloudFileDirectory getSubDirectoryReference(final String itemName) throws URISyntaxException, StorageException { Utility.assertNotNullOrEmpty("itemName", itemName); StorageUri subdirectoryUri = PathUtility.appendPathToUri(this.storageUri, itemName); return new CloudFileDirectory(subdirectoryUri, itemName, this.getShare()); }
/** * Returns a reference to a {@link CloudFile} object that represents a file in this directory. * * @param fileName A <code>String</code> that represents the name of the file. * @return A {@link CloudFile} object that represents a reference to the specified file. * @throws StorageException If a storage service error occurred. * @throws URISyntaxException If the resource URI is invalid. */ public CloudFile getFileReference(final String fileName) throws URISyntaxException, StorageException { Utility.assertNotNullOrEmpty("fileName", fileName); StorageUri subdirectoryUri = PathUtility.appendPathToUri(this.storageUri, fileName); return new CloudFile(subdirectoryUri, this.fileServiceClient, this.getShare()); }
/** * Returns the {@link CloudFileDirectory} parent directory associated with this directory. * * @return An {@link CloudFileDirectory} object that represents the parent directory associated * with the directory. * @throws StorageException * @throws URISyntaxException */ @Override public CloudFileDirectory getParent() throws URISyntaxException, StorageException { if (this.parent == null) { final String parentName = CloudFile.getParentNameFromURI(this.getStorageUri(), this.getShare()); if (parentName != null) { StorageUri parentURI = PathUtility.appendPathToUri(this.getShare().getStorageUri(), parentName); this.parent = new CloudFileDirectory(parentURI, this.getServiceClient()); } } return this.parent; }