接口 FilesService


  • public interface FilesService
    Vault provides a storage for files saving.

    Files can be uploading, downloading and getting the status and information.

    • 方法概要

      所有方法 实例方法 抽象方法 
      修饰符和类型 方法 说明
      java.util.concurrent.CompletableFuture<java.lang.Void> copy​(java.lang.String source, java.lang.String target)
      Copies a file or a folder (recursively).
      java.util.concurrent.CompletableFuture<java.lang.Void> delete​(java.lang.String path)
      Deletes a file, or a folder.
      java.util.concurrent.CompletableFuture<java.io.Reader> getDownloadReader​(java.lang.String path)  
      java.util.concurrent.CompletableFuture<java.io.InputStream> getDownloadStream​(java.lang.String path)
      Initiates a download sequence by returning a Reader or InputStream object that can be used to read the download file in chunks.
      java.util.concurrent.CompletableFuture<UploadStream> getPublicUploadStream​(java.lang.String path)  
      java.util.concurrent.CompletableFuture<UploadWriter> getPublicUploadWriter​(java.lang.String path)  
      java.util.concurrent.CompletableFuture<UploadStream> getUploadStream​(java.lang.String path)
      Initiates an upload sequence by returning a Write or OutputStream object that can be used to write small file chunks.
      java.util.concurrent.CompletableFuture<UploadWriter> getUploadWriter​(java.lang.String path)  
      java.util.concurrent.CompletableFuture<java.lang.String> hash​(java.lang.String path)
      Returns the SHA256 hash of the given file.
      java.util.concurrent.CompletableFuture<java.util.List<FileInfo>> list​(java.lang.String path)
      Returns the list of all files in a given folder.
      java.util.concurrent.CompletableFuture<java.lang.Void> move​(java.lang.String source, java.lang.String target)
      Moves (or renames) a file or folder.
      java.util.concurrent.CompletableFuture<FileInfo> stat​(java.lang.String path)
      Information about the target file or folder.
    • 方法详细资料

      • getUploadStream

        java.util.concurrent.CompletableFuture<UploadStream> getUploadStream​(java.lang.String path)
        Initiates an upload sequence by returning a Write or OutputStream object that can be used to write small file chunks. After writing, flush()/close() must be called to actually send the data remotely.
        参数:
        path - the path for the remote file scriptName used to download file anonymously by the scripting service with uploading public file.
        返回:
        the new CompletionStage, the result is the Writer or OutputStream interface for upload the file content if success; null otherwise
      • getPublicUploadStream

        java.util.concurrent.CompletableFuture<UploadStream> getPublicUploadStream​(java.lang.String path)
      • getUploadWriter

        java.util.concurrent.CompletableFuture<UploadWriter> getUploadWriter​(java.lang.String path)
      • getPublicUploadWriter

        java.util.concurrent.CompletableFuture<UploadWriter> getPublicUploadWriter​(java.lang.String path)
      • getDownloadStream

        java.util.concurrent.CompletableFuture<java.io.InputStream> getDownloadStream​(java.lang.String path)
        Initiates a download sequence by returning a Reader or InputStream object that can be used to read the download file in chunks.
        参数:
        path - the path for the remote file
        返回:
        the new CompletionStage, the result is the Reader or InputStream interface for read the file content if success; null otherwise
      • getDownloadReader

        java.util.concurrent.CompletableFuture<java.io.Reader> getDownloadReader​(java.lang.String path)
      • list

        java.util.concurrent.CompletableFuture<java.util.List<FileInfo>> list​(java.lang.String path)
        Returns the list of all files in a given folder.
        参数:
        path - the path for the remote folder
        返回:
        the new CompletionStage, the result is List if success; null otherwise
      • stat

        java.util.concurrent.CompletableFuture<FileInfo> stat​(java.lang.String path)
        Information about the target file or folder.
        参数:
        path - the path for the remote file or folder
        返回:
        the new CompletionStage, the result is FileInfo if success; null otherwise
      • hash

        java.util.concurrent.CompletableFuture<java.lang.String> hash​(java.lang.String path)
        Returns the SHA256 hash of the given file.
        参数:
        path - path for the remote file
        返回:
        the new CompletionStage, the result is the base64 hash string if the hash successfully calculated; null otherwise
      • move

        java.util.concurrent.CompletableFuture<java.lang.Void> move​(java.lang.String source,
                                                                    java.lang.String target)
        Moves (or renames) a file or folder.
        参数:
        source - the path to the file or folder to move
        target - the path to the target file or folder
        返回:
        The future object that would hold the result of moving operation. When the result value is true, it means the file or folder has been moved to target path in success. Otherwise, it will return result with false.
      • copy

        java.util.concurrent.CompletableFuture<java.lang.Void> copy​(java.lang.String source,
                                                                    java.lang.String target)
        Copies a file or a folder (recursively).
        参数:
        source - the path for the remote source file or folder
        target - the path for the remote destination file or folder
        返回:
        the new CompletionStage, the result is true if the file or folder successfully copied; false otherwise
      • delete

        java.util.concurrent.CompletableFuture<java.lang.Void> delete​(java.lang.String path)
        Deletes a file, or a folder. In case the given path is a folder, deletion is recursive.
        参数:
        path - the path for the remote file or folder
        返回:
        the new CompletionStage, the result is true if the file or folder successfully deleted; false otherwise