Interface MongoGridFsClient


  • public interface MongoGridFsClient
    • Method Detail

      • delete

        Future<Void> delete​(String id)
        Deletes a file by it's ID
        Parameters:
        id - the identifier of the file
        Returns:
        a future notified when the operation completes
      • downloadFile

        Future<Long> downloadFile​(String fileName)
        Downloads a file.
        Parameters:
        fileName - the name of the file to download
        Returns:
        a future notified with the result
      • downloadFileAs

        Future<Long> downloadFileAs​(String fileName,
                                    String newFileName)
        Downloads a file and gives it a new name.
        Parameters:
        fileName - the name of the file to download
        newFileName - the name the file should be saved as
        Returns:
        a future notified with the result
      • downloadFileByID

        Future<Long> downloadFileByID​(String id,
                                      String fileName)
        Downloads a file using the ID generated by GridFs.
        Parameters:
        id - the GridFs Object ID of the file to download
        Returns:
        a future notified with the result
      • drop

        Future<Void> drop()
        Drops the entire file bucket with all of its contents
        Returns:
        a future notified when the operation completes
      • findAllIds

        Future<List<String>> findAllIds()
        Finds all file ids in the bucket
        Returns:
        a future notified with the result
      • findIds

        Future<List<String>> findIds​(JsonObject query)
        Finds all file ids that match a query.
        Parameters:
        query - a bson query expressed as json that will be used to match files
        Returns:
        a future notified with the result
      • uploadFile

        Future<String> uploadFile​(String fileName)
        Upload a file to gridfs
        Parameters:
        fileName - the name of the file to store in gridfs
        Returns:
        a future notified with the result
      • uploadFileWithOptions

        Future<String> uploadFileWithOptions​(String fileName,
                                             GridFsUploadOptions options)
        Upload a file to gridfs with options
        Parameters:
        fileName - the name of the file to store in gridfs
        options - GridFsUploadOptions for specifying metadata and chunk size
        Returns:
        a future notified with the result
      • close

        void close()
        Close the client and release its resources