Class AzureFileSystem

    • Method Detail

      • getFileSystemType

        public String getFileSystemType​(Path path)
        Description copied from interface: FileSystem
        Returns an identifier for the filesystem type. This identifier is used for reporting statistics to be able to distinguish local from non-local io.
        Specified by:
        getFileSystemType in interface FileSystem
        Parameters:
        path - the path
        Returns:
        a unique identifier
      • getProvider

        public FileSystemProvider getProvider()
        Description copied from interface: FileSystem
        Gets the provider for the path scheme associated with the file system.
        Specified by:
        getProvider in interface FileSystem
        Returns:
        the associated provider object
      • supportsRandomAccess

        public boolean supportsRandomAccess()
        Description copied from interface: FileSystem
        Indicates whether the file system supports random access to files.

        If a file system does not support random access, calling FileClient.newFileChannel(Path) will raise an error for paths referring to the file system.

        Specified by:
        supportsRandomAccess in interface FileSystem
        Returns:
        true if random access is supported, false otherwise.
      • supportsDirectories

        public boolean supportsDirectories()
        Description copied from interface: FileSystem
        Indicates whether the file system supports directories.
        Specified by:
        supportsDirectories in interface FileSystem
        Returns:
        true if directories are supported, false otherwise.
      • matchPaths

        public List<PathDetails> matchPaths​(String pattern)
                                     throws IOException
        Description copied from interface: FileSystem
        Gets all paths which match the given pattern. Patterns may be scheme-specific; refer to the provider implementation of a specific scheme to determine valid pattern syntax.
        Specified by:
        matchPaths in interface FileSystem
        Parameters:
        pattern - the file pattern to use
        Returns:
        all paths matching the pattern
        Throws:
        IOException - if I/O errors occur
      • createDirectories

        public Path createDirectories​(Path path)
                               throws IOException
        Description copied from interface: FileSystem
        Creates the directory identified by the given path, creating any necessary parent directories.
        Specified by:
        createDirectories in interface FileSystem
        Parameters:
        path - the directory to create
        Returns:
        the path to the directory
        Throws:
        IOException - if I/O errors occur
      • createDirectory

        public Path createDirectory​(Path path)
                             throws IOException
        Description copied from interface: FileSystem
        Creates the directory identified by the given path. All parent directories must already exist. Use FileSystem.createDirectories(Path) if nonexistent parents need to be created.
        Specified by:
        createDirectory in interface FileSystem
        Parameters:
        path - the directory to create
        Returns:
        the path to the directory
        Throws:
        IOException - if I/O errors occur or if the parent directory does not exist
      • createNewFile

        public boolean createNewFile​(Path path)
                              throws IOException
        Description copied from interface: FileSystem
        Creates the file identified by the given path, if it doesn't already exist. All parent directories must already exist. Use FileSystem.createDirectories(Path) if nonexistent parents need to be created.
        Specified by:
        createNewFile in interface FileSystem
        Parameters:
        path - the directory to create
        Returns:
        true if the file was created, false if it already existed.
        Throws:
        IOException - if I/O errors occur or if the parent directory does not exist
      • delete

        public void delete​(Path path,
                           boolean recursively)
                    throws IOException
        Description copied from interface: FileSystem
        Deletes the file or directory identified by the specified path. If the path is a directory, the contents will be deleted recursively as indicated. It is not an error to delete a non-existent path.
        Specified by:
        delete in interface FileSystem
        Parameters:
        path - the file or directory to delete
        recursively - indicates whether deletes of directories should recursively delete the contents
        Throws:
        IOException - if I/O errors occur or if the path identifies a non-empty directory and a recursive delete was not requested
      • move

        public boolean move​(FileSystem fromFS,
                            Path from,
                            Path to)
                     throws IOException
        Description copied from interface: FileSystem
        Moves a file or directory from one location to another if possible.
        Specified by:
        move in interface FileSystem
        Parameters:
        fromFS - the source filesystem
        from - the source location
        to - the target location
        Returns:
        true if a move was possible (otherwise caller should fall back to copy-and-delete)
        Throws:
        IOException - if I/O errors occur
      • newInputStream

        public InputStream newInputStream​(Path path)
                                   throws IOException
        Description copied from interface: FileSystem
        Opens the specified file for reading. If the path identifies a directory, all files in the directory are read as a concatenated stream, in the order they are returned by #listFiles(Path). The read starts at the first byte of the (first) file. The returned stream is generally not buffered; consult specific implementations for details.
        Specified by:
        newInputStream in interface FileSystem
        Parameters:
        path - the file or directory to read
        Returns:
        a stream for reading the contents of the path
        Throws:
        IOException - if I/O errors occur
      • newOutputStream

        public OutputStream newOutputStream​(Path path,
                                            WriteMode mode)
                                     throws IOException
        Description copied from interface: FileSystem
        Opens the specified file for writing. Behavior depends on the provided mode and whether the target file exists. If the target file does not exist, it is created and the resulting stream is positioned at the first byte. Otherwise, if the target file exists:
        • If the mode is CREATE_NEW, an error is raised.
        • If the mode is OVERWRITE, the existing file is replaced with the byte written to the resulting stream.
        • If the mode is APPEND, the resulting stream is positioned after the last byte of the existing file.

        The returned stream is generally not buffered; consult specific implementations for details.

        Specified by:
        newOutputStream in interface FileSystem
        Parameters:
        path - the file to write
        mode - how to handle writes to existing files
        Returns:
        a stream for writing (or appending) the contents of the file
        Throws:
        IOException - if I/O errors occur or if the target is a directory
      • newFileChannel

        public FileChannel newFileChannel​(Path path)
                                   throws IOException
        Description copied from interface: FileSystem
        Opens the specified file for random access. Not all schemes support random access; consult specific implementations for details.
        Specified by:
        newFileChannel in interface FileSystem
        Parameters:
        path - the file or directory to read
        Returns:
        a stream for reading the contents of the path
        Throws:
        IOException - if I/O errors occur
      • exists

        public boolean exists​(Path path)
                       throws IOException
        Description copied from interface: FileSystem
        Indicates whether the specified path represents an existing file or directory.
        Specified by:
        exists in interface FileSystem
        Parameters:
        path - the path to test
        Returns:
        true the path exists, false otherwise.
        Throws:
        IOException - if I/O errors occur
      • getDetails

        public PathDetails getDetails​(Path path)
                               throws IOException
        Description copied from interface: FileSystem
        Returns metadata associated with the specified path.
        Specified by:
        getDetails in interface FileSystem
        Parameters:
        path - the path for which to get metadata
        Returns:
        metadata for the specified file system object, if it exists. null if it does not exist.
        Throws:
        IOException - if I/O errors occur
      • getLength

        public long getLength​(Path path)
                       throws IOException
        Description copied from interface: FileSystem
        Returns the length of the file represented by the given path.
        Specified by:
        getLength in interface FileSystem
        Parameters:
        path - the path to test
        Returns:
        the length of the file
        Throws:
        IOException - if I/O errors occur
      • isDirectory

        public boolean isDirectory​(Path path)
                            throws IOException
        Description copied from interface: FileSystem
        Indicates whether the specified path represents a directory.
        Specified by:
        isDirectory in interface FileSystem
        Parameters:
        path - the path to test
        Returns:
        true the path represents a directory,
        Throws:
        IOException
      • isFile

        public boolean isFile​(Path path)
                       throws IOException
        Description copied from interface: FileSystem
        Indicates whether the specified path represents a file.
        Specified by:
        isFile in interface FileSystem
        Parameters:
        path - the path to test
        Returns:
        true the path represents a file,
        Throws:
        IOException
      • isReadable

        public boolean isReadable​(Path path)
                           throws IOException
        Description copied from interface: FileSystem
        Indicates whether the specified path can be read.
        Specified by:
        isReadable in interface FileSystem
        Parameters:
        path - the path to test
        Returns:
        true the path represents a readable file or directory, false otherwise.
        Throws:
        IOException - if I/O errors occur
      • isWritable

        public boolean isWritable​(Path path)
                           throws IOException
        Description copied from interface: FileSystem
        Indicates whether the specified path can be written.
        Specified by:
        isWritable in interface FileSystem
        Parameters:
        path - the path to test
        Returns:
        true the path represents a readable file or directory, false otherwise.
        Throws:
        IOException - if I/O errors occur
      • isCreatable

        public boolean isCreatable​(Path path)
                            throws IOException
        Description copied from interface: FileSystem
        Indicates whether the specified path can be created.
        Specified by:
        isCreatable in interface FileSystem
        Parameters:
        path - the path to test
        Returns:
        true the path represents a nonexistent file or directory which could be created, false otherwise.
        Throws:
        IOException - if I/O errors occur
      • isHidden

        public boolean isHidden​(Path path)
                         throws IOException
        Description copied from interface: FileSystem
        Indicates whether the associated path is hidden by the file system.
        Specified by:
        isHidden in interface FileSystem
        Parameters:
        path - the path to test
        Returns:
        true if the path is hidden, false otherwise.
        Throws:
        IOException - if I/O errors occur
      • listDirectory

        public List<PathDetails> listDirectory​(Path path,
                                               DirectoryFilter filter)
                                        throws IOException
        Description copied from interface: FileSystem
        Gets the contents of the specified directory, applying a filter.
        Specified by:
        listDirectory in interface FileSystem
        Parameters:
        path - the directory for which to get a filtered content list
        filter - a filter to apply to the contents
        Returns:
        all children of the directory which pass the filter
        Throws:
        IOException - if I/O errors occur or if the path identifies a file
      • getSplits

        public SplitIterator getSplits​(Path path,
                                       SplitOptions options)
                                throws IOException
        Description copied from interface: FileSystem
        Computes data splits over the specified file. The supplied options are used to control the division of the file into splits, if the file system supports it.

        If a provider can provide locality information, it should, as this can be used to guide distributed execution.

        Specified by:
        getSplits in interface FileSystem
        Parameters:
        path - the file for which to get splits
        options - configuration for the process of dividing the file
        Returns:
        an iterator generating the data splits over the target
        Throws:
        IOException - if an I/O error occurs
      • supportsConcat

        public boolean supportsConcat()
        Description copied from interface: FileSystem
        Returns whether this filesystem supports the concat method.
        Specified by:
        supportsConcat in interface FileSystem
        Returns:
        whether this filesystem supports the concat method
      • concat

        public InputStream concat​(List<Path> paths,
                                  boolean ignoreNonExistent)
                           throws IOException
        Description copied from interface: FileSystem
        Returns an input stream consisting of the given list of paths concatenated together. Most filesystem implementations should not need to implement this method. This is an optimization for remote filesystems to perform a bulk-fetch.
        Specified by:
        concat in interface FileSystem
        Parameters:
        paths - the list of paths
        ignoreNonExistent - whether to skip non-existent files
        Returns:
        a concatenated input stream
        Throws:
        IOException