Class AzureFileSystem
- java.lang.Object
-
- java.nio.file.FileSystem
-
- com.azure.storage.blob.nio.AzureFileSystem
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public final class AzureFileSystem extends FileSystem
Implement's Java'sFileSystem
interface for Azure Blob Storage.The following behavior is specific to this FileSystem:
In the hierarchy of this file system, an
AzureFileSystem
corresponds to an Azure Blob Storage account. A file store is represented by a container in the storage account. Each container has one root directory.Closing the file system will not block on outstanding operations. Any operations in progress will be allowed to terminate naturally after the file system is closed, though no further operations may be started after the parent file system is closed.
All instance of
AzureFileSystem
are opened for read-write access.For a more complete description of the uses for the constants described here, please see the instructions for opening and configuring a FileSystem in the docs of
FileSystemProvider
.
-
-
Field Summary
Fields Modifier and Type Field Description static String
AZURE_STORAGE_DOWNLOAD_RESUME_RETRIES
Expected type: Integerstatic String
AZURE_STORAGE_FILE_STORES
Expected type: Stringstatic String
AZURE_STORAGE_HTTP_LOG_DETAIL_LEVEL
Expected type: com.azure.core.http.policy.HttpLogLevelDetailstatic String
AZURE_STORAGE_MAX_CONCURRENCY_PER_REQUEST
Expected type: Integerstatic String
AZURE_STORAGE_MAX_RETRY_DELAY_IN_MS
Expected type: Longstatic String
AZURE_STORAGE_MAX_TRIES
Expected type: Integerstatic String
AZURE_STORAGE_PUT_BLOB_THRESHOLD
Expected type: Longstatic String
AZURE_STORAGE_RETRY_DELAY_IN_MS
Expected type: Longstatic String
AZURE_STORAGE_RETRY_POLICY_TYPE
Expected type: com.azure.storage.common.policy.RetryPolicyTypestatic String
AZURE_STORAGE_SAS_TOKEN_CREDENTIAL
Expected type: Stringstatic String
AZURE_STORAGE_SECONDARY_HOST
Expected type: Stringstatic String
AZURE_STORAGE_SHARED_KEY_CREDENTIAL
Expected type: Stringstatic String
AZURE_STORAGE_SKIP_INITIAL_CONTAINER_CHECK
Expected type: Booleanstatic String
AZURE_STORAGE_TRY_TIMEOUT
Expected type: Integerstatic String
AZURE_STORAGE_UPLOAD_BLOCK_SIZE
Expected type: Long
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this file system.boolean
equals(Object o)
Iterable<FileStore>
getFileStores()
Returns an object to iterate over the underlying file storesPath
getPath(String first, String... more)
Converts a path string, or a sequence of more that when joined form a path string, to a Path.PathMatcher
getPathMatcher(String s)
Unsupported.Iterable<Path>
getRootDirectories()
Returns an object to iterate over the paths of the root directories.String
getSeparator()
Returns the name separator, represented as a string.UserPrincipalLookupService
getUserPrincipalLookupService()
Unsupported.int
hashCode()
boolean
isOpen()
Tells whether this file system is open.boolean
isReadOnly()
Tells whether this file system allows only read-only access to its file stores.WatchService
newWatchService()
Unsupported.FileSystemProvider
provider()
Returns the provider that created this file system.Set<String>
supportedFileAttributeViews()
Returns the set of the names of the file attribute views supported by this FileSystem.
-
-
-
Field Detail
-
AZURE_STORAGE_SHARED_KEY_CREDENTIAL
public static final String AZURE_STORAGE_SHARED_KEY_CREDENTIAL
Expected type: String- See Also:
- Constant Field Values
-
AZURE_STORAGE_SAS_TOKEN_CREDENTIAL
public static final String AZURE_STORAGE_SAS_TOKEN_CREDENTIAL
Expected type: String- See Also:
- Constant Field Values
-
AZURE_STORAGE_HTTP_LOG_DETAIL_LEVEL
public static final String AZURE_STORAGE_HTTP_LOG_DETAIL_LEVEL
Expected type: com.azure.core.http.policy.HttpLogLevelDetail- See Also:
- Constant Field Values
-
AZURE_STORAGE_MAX_TRIES
public static final String AZURE_STORAGE_MAX_TRIES
Expected type: Integer- See Also:
- Constant Field Values
-
AZURE_STORAGE_TRY_TIMEOUT
public static final String AZURE_STORAGE_TRY_TIMEOUT
Expected type: Integer- See Also:
- Constant Field Values
-
AZURE_STORAGE_RETRY_DELAY_IN_MS
public static final String AZURE_STORAGE_RETRY_DELAY_IN_MS
Expected type: Long- See Also:
- Constant Field Values
-
AZURE_STORAGE_MAX_RETRY_DELAY_IN_MS
public static final String AZURE_STORAGE_MAX_RETRY_DELAY_IN_MS
Expected type: Long- See Also:
- Constant Field Values
-
AZURE_STORAGE_RETRY_POLICY_TYPE
public static final String AZURE_STORAGE_RETRY_POLICY_TYPE
Expected type: com.azure.storage.common.policy.RetryPolicyType- See Also:
- Constant Field Values
-
AZURE_STORAGE_SECONDARY_HOST
public static final String AZURE_STORAGE_SECONDARY_HOST
Expected type: String- See Also:
- Constant Field Values
-
AZURE_STORAGE_UPLOAD_BLOCK_SIZE
public static final String AZURE_STORAGE_UPLOAD_BLOCK_SIZE
Expected type: Long- See Also:
- Constant Field Values
-
AZURE_STORAGE_MAX_CONCURRENCY_PER_REQUEST
public static final String AZURE_STORAGE_MAX_CONCURRENCY_PER_REQUEST
Expected type: Integer- See Also:
- Constant Field Values
-
AZURE_STORAGE_PUT_BLOB_THRESHOLD
public static final String AZURE_STORAGE_PUT_BLOB_THRESHOLD
Expected type: Long- See Also:
- Constant Field Values
-
AZURE_STORAGE_DOWNLOAD_RESUME_RETRIES
public static final String AZURE_STORAGE_DOWNLOAD_RESUME_RETRIES
Expected type: Integer- See Also:
- Constant Field Values
-
AZURE_STORAGE_FILE_STORES
public static final String AZURE_STORAGE_FILE_STORES
Expected type: String- See Also:
- Constant Field Values
-
AZURE_STORAGE_SKIP_INITIAL_CONTAINER_CHECK
public static final String AZURE_STORAGE_SKIP_INITIAL_CONTAINER_CHECK
Expected type: Boolean- See Also:
- Constant Field Values
-
-
Method Detail
-
provider
public FileSystemProvider provider()
Returns the provider that created this file system.- Specified by:
provider
in classFileSystem
- Returns:
- the provider that created this file system.
-
close
public void close() throws IOException
Closes this file system.After a file system is closed then all subsequent access to the file system, either by methods defined by this class or on objects associated with this file system, throw ClosedFileSystemException. If the file system is already closed then invoking this method has no effect.
Closing the file system will not block on outstanding operations. Any operations in progress will be allowed to terminate naturally after the file system is closed, though no further operations may be started after the parent file system is closed.
Once closed, a file system with the same identifier as the one closed may be re-opened.
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classFileSystem
- Throws:
IOException
- If an I/O error occurs.
-
isOpen
public boolean isOpen()
Tells whether this file system is open.- Specified by:
isOpen
in classFileSystem
- Returns:
- whether this file system is open.
-
isReadOnly
public boolean isReadOnly()
Tells whether this file system allows only read-only access to its file stores.Always returns false. It may be the case that the authentication method provided to this file system only supports read operations and hence the file system is implicitly read only in this view, but that does not imply the underlying account/file system is inherently read only. Creating/specifying read only file systems is not supported.
- Specified by:
isReadOnly
in classFileSystem
- Returns:
- false
-
getSeparator
public String getSeparator()
Returns the name separator, represented as a string.The separator used in this file system is
"/"
.- Specified by:
getSeparator
in classFileSystem
- Returns:
- "/"
-
getRootDirectories
public Iterable<Path> getRootDirectories()
Returns an object to iterate over the paths of the root directories.The list of root directories corresponds to the list of available file stores and therefore containers specified upon initialization. A root directory always takes the form
"<file-store-name>:"
. This list will respect the parameters provided during initialization.If a finite list of containers was provided on start up, this list will not change during the lifetime of this object. If containers are added to the account after initialization, they will be ignored. If a container is deleted or otherwise becomes unavailable, its root directory will still be returned but operations to it will fail.
- Specified by:
getRootDirectories
in classFileSystem
- Returns:
- an object to iterate over the paths of the root directories
-
getFileStores
public Iterable<FileStore> getFileStores()
Returns an object to iterate over the underlying file storesThis list will respect the parameters provided during initialization.
If a finite list of containers was provided on start up, this list will not change during the lifetime of this object. If containers are added to the account after initialization, they will be ignored. If a container is deleted or otherwise becomes unavailable, its root directory will still be returned but operations to it will fail.
- Specified by:
getFileStores
in classFileSystem
-
supportedFileAttributeViews
public Set<String> supportedFileAttributeViews()
Returns the set of the names of the file attribute views supported by this FileSystem.This file system supports the following views:
- Specified by:
supportedFileAttributeViews
in classFileSystem
-
getPath
public Path getPath(String first, String... more)
Converts a path string, or a sequence of more that when joined form a path string, to a Path.If more does not specify any elements then the value of the first parameter is the path string to convert. If more specifies one or more elements than each non-empty string, including first, is considered to be a sequence of name elements (see Path) and is joined to form a path string. The more will be joined using the name separator.
Each name element will be
String
-joined to the other elements by this file system's first path separator. Naming conventions and allowed characters are as defined by the Azure Blob Storage service. The root component is interpreted as the container name and all name elements are interpreted as a part of the blob name. The character':'
is only allowed in the root component and must be the last character of the root component.- Specified by:
getPath
in classFileSystem
- Parameters:
first
- the path string or initial part of the path stringmore
- additional strings to be joined to form the path string- Throws:
InvalidPathException
- if the path string cannot be converted.
-
getPathMatcher
public PathMatcher getPathMatcher(String s) throws IllegalArgumentException, PatternSyntaxException
Unsupported.- Specified by:
getPathMatcher
in classFileSystem
- Parameters:
s
- the matcher- Throws:
UnsupportedOperationException
- unsupported.IllegalArgumentException
- neverPatternSyntaxException
- never
-
getUserPrincipalLookupService
public UserPrincipalLookupService getUserPrincipalLookupService()
Unsupported.- Specified by:
getUserPrincipalLookupService
in classFileSystem
- Throws:
UnsupportedOperationException
- unsupported.
-
newWatchService
public WatchService newWatchService() throws IOException
Unsupported.- Specified by:
newWatchService
in classFileSystem
- Throws:
UnsupportedOperationException
- unsupported.IOException
- Never thrown.
-
-