Class MongoGridFsClient


  • public class MongoGridFsClient
    extends Object
    • Field Detail

      • __TYPE_ARG

        public static final io.vertx.lang.rx.TypeArg<MongoGridFsClient> __TYPE_ARG
    • Constructor Detail

      • MongoGridFsClient

        public MongoGridFsClient​(Object delegate)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • delete

        public Completable 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
      • rxDelete

        public Completable rxDelete​(String id)
        Deletes a file by it's ID
        Parameters:
        id - the identifier of the file
        Returns:
        a future notified when the operation completes
      • readByFileName

        public ReadStream<Buffer> readByFileName​(String fileName)
        Read file by name to ReadStream
        Parameters:
        fileName -
        Returns:
      • readByFileNameWithOptions

        public ReadStream<Buffer> readByFileNameWithOptions​(String fileName,
                                                            GridFsDownloadOptions options)
        Read file by name to ReadStream with options
        Parameters:
        fileName -
        options -
        Returns:
      • readById

        public ReadStream<Buffer> readById​(String id)
        Read file by id to ReadStream
        Parameters:
        id -
        Returns:
      • downloadFile

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

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

        public Single<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
      • rxDownloadFileAs

        public Single<Long> rxDownloadFileAs​(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

        public Single<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
        fileName -
        Returns:
        a future notified with the result
      • rxDownloadFileByID

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

        public Completable drop()
        Drops the entire file bucket with all of its contents
        Returns:
        a future notified when the operation completes
      • rxDrop

        public Completable rxDrop()
        Drops the entire file bucket with all of its contents
        Returns:
        a future notified when the operation completes
      • findAllIds

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

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

        public Single<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
      • rxFindIds

        public Single<List<String>> rxFindIds​(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

        public Single<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
      • rxUploadFile

        public Single<String> rxUploadFile​(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

        public Single<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
      • rxUploadFileWithOptions

        public Single<String> rxUploadFileWithOptions​(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

        public void close()
        Close the client and release its resources