Class MongoGridFsClient


  • public class MongoGridFsClient
    extends Object
    • Constructor Detail

      • MongoGridFsClient

        public MongoGridFsClient​(io.vertx.ext.mongo.MongoGridFsClient delegate)
      • MongoGridFsClient

        public MongoGridFsClient​(Object delegate)
    • Method Detail

      • hashCode

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

        public io.vertx.ext.mongo.MongoGridFsClient getDelegate()
      • delete

        public MongoGridFsClient delete​(String id,
                                        io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> resultHandler)
        Deletes a file by it's ID
        Parameters:
        id - the identifier of the file
        resultHandler - will be called when the file is deleted
        Returns:
      • delete

        public MongoGridFsClient delete​(String id)
        Deletes a file by it's ID
        Parameters:
        id - the identifier of the file
        Returns:
      • rxDelete

        public rx.Single<Void> rxDelete​(String id)
        Deletes a file by it's ID
        Parameters:
        id - the identifier of the file
        Returns:
      • readByFileName

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

        public ReadStream<Buffer> readByFileNameWithOptions​(String fileName,
                                                            io.vertx.ext.mongo.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:
      • downloadByFileNameWithOptions

        public MongoGridFsClient downloadByFileNameWithOptions​(WriteStream<Buffer> stream,
                                                               String fileName,
                                                               io.vertx.ext.mongo.GridFsDownloadOptions options,
                                                               io.vertx.core.Handler<io.vertx.core.AsyncResult<Long>> resultHandler)
      • rxDownloadByFileNameWithOptions

        public rx.Single<Long> rxDownloadByFileNameWithOptions​(WriteStream<Buffer> stream,
                                                               String fileName,
                                                               io.vertx.ext.mongo.GridFsDownloadOptions options)
      • downloadFile

        public MongoGridFsClient downloadFile​(String fileName,
                                              io.vertx.core.Handler<io.vertx.core.AsyncResult<Long>> resultHandler)
        Downloads a file.
        Parameters:
        fileName - the name of the file to download
        resultHandler - called when the file is downloaded and returns the length in bytes
        Returns:
      • downloadFile

        public MongoGridFsClient downloadFile​(String fileName)
        Downloads a file.
        Parameters:
        fileName - the name of the file to download
        Returns:
      • rxDownloadFile

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

        public MongoGridFsClient downloadFileAs​(String fileName,
                                                String newFileName,
                                                io.vertx.core.Handler<io.vertx.core.AsyncResult<Long>> resultHandler)
        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
        resultHandler - called when the file is downloaded and returns the length in bytes
        Returns:
      • downloadFileAs

        public MongoGridFsClient 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:
      • rxDownloadFileAs

        public rx.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:
      • downloadFileByID

        public MongoGridFsClient downloadFileByID​(String id,
                                                  String fileName,
                                                  io.vertx.core.Handler<io.vertx.core.AsyncResult<Long>> resultHandler)
        Downloads a file using the ID generated by GridFs.
        Parameters:
        id - the GridFs Object ID of the file to download
        fileName -
        resultHandler - called when the file is downloaded and returns the length in bytes
        Returns:
      • downloadFileByID

        public MongoGridFsClient 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:
      • rxDownloadFileByID

        public rx.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:
      • drop

        public MongoGridFsClient drop​(io.vertx.core.Handler<io.vertx.core.AsyncResult<Void>> resultHandler)
        Drops the entire file bucket with all of its contents
        Parameters:
        resultHandler - called when the bucket is dropped
        Returns:
      • drop

        public MongoGridFsClient drop()
        Drops the entire file bucket with all of its contents
        Returns:
      • rxDrop

        public rx.Single<Void> rxDrop()
        Drops the entire file bucket with all of its contents
        Returns:
      • findAllIds

        public MongoGridFsClient findAllIds​(io.vertx.core.Handler<io.vertx.core.AsyncResult<List<String>>> resultHandler)
        Finds all file ids in the bucket
        Parameters:
        resultHandler - called when the list of file ids is available
        Returns:
      • findAllIds

        public MongoGridFsClient findAllIds()
        Finds all file ids in the bucket
        Returns:
      • rxFindAllIds

        public rx.Single<List<String>> rxFindAllIds()
        Finds all file ids in the bucket
        Returns:
      • findIds

        public MongoGridFsClient findIds​(io.vertx.core.json.JsonObject query,
                                         io.vertx.core.Handler<io.vertx.core.AsyncResult<List<String>>> resultHandler)
        Finds all file ids that match a query.
        Parameters:
        query - a bson query expressed as json that will be used to match files
        resultHandler - called when the list of file ids is available
        Returns:
      • findIds

        public MongoGridFsClient findIds​(io.vertx.core.json.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:
      • rxFindIds

        public rx.Single<List<String>> rxFindIds​(io.vertx.core.json.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:
      • uploadByFileName

        public MongoGridFsClient uploadByFileName​(rx.Observable<Buffer> stream,
                                                  String fileName,
                                                  io.vertx.core.Handler<io.vertx.core.AsyncResult<String>> resultHandler)
      • rxUploadByFileName

        public rx.Single<String> rxUploadByFileName​(rx.Observable<Buffer> stream,
                                                    String fileName)
      • uploadByFileNameWithOptions

        public MongoGridFsClient uploadByFileNameWithOptions​(ReadStream<Buffer> stream,
                                                             String fileName,
                                                             io.vertx.ext.mongo.GridFsUploadOptions options,
                                                             io.vertx.core.Handler<io.vertx.core.AsyncResult<String>> resultHandler)
      • rxUploadByFileNameWithOptions

        public rx.Single<String> rxUploadByFileNameWithOptions​(ReadStream<Buffer> stream,
                                                               String fileName,
                                                               io.vertx.ext.mongo.GridFsUploadOptions options)
      • uploadByFileNameWithOptions

        public MongoGridFsClient uploadByFileNameWithOptions​(rx.Observable<Buffer> stream,
                                                             String fileName,
                                                             io.vertx.ext.mongo.GridFsUploadOptions options,
                                                             io.vertx.core.Handler<io.vertx.core.AsyncResult<String>> resultHandler)
      • uploadByFileNameWithOptions

        public MongoGridFsClient uploadByFileNameWithOptions​(rx.Observable<Buffer> stream,
                                                             String fileName,
                                                             io.vertx.ext.mongo.GridFsUploadOptions options)
      • rxUploadByFileNameWithOptions

        public rx.Single<String> rxUploadByFileNameWithOptions​(rx.Observable<Buffer> stream,
                                                               String fileName,
                                                               io.vertx.ext.mongo.GridFsUploadOptions options)
      • uploadFile

        public MongoGridFsClient uploadFile​(String fileName,
                                            io.vertx.core.Handler<io.vertx.core.AsyncResult<String>> resultHandler)
        Upload a file to gridfs
        Parameters:
        fileName - the name of the file to store in gridfs
        resultHandler - the id of the file that was uploaded
        Returns:
      • uploadFile

        public MongoGridFsClient uploadFile​(String fileName)
        Upload a file to gridfs
        Parameters:
        fileName - the name of the file to store in gridfs
        Returns:
      • rxUploadFile

        public rx.Single<String> rxUploadFile​(String fileName)
        Upload a file to gridfs
        Parameters:
        fileName - the name of the file to store in gridfs
        Returns:
      • uploadFileWithOptions

        public MongoGridFsClient uploadFileWithOptions​(String fileName,
                                                       io.vertx.ext.mongo.GridFsUploadOptions options,
                                                       io.vertx.core.Handler<io.vertx.core.AsyncResult<String>> resultHandler)
        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
        resultHandler - the id of the file that was uploaded
        Returns:
      • uploadFileWithOptions

        public MongoGridFsClient uploadFileWithOptions​(String fileName,
                                                       io.vertx.ext.mongo.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:
      • rxUploadFileWithOptions

        public rx.Single<String> rxUploadFileWithOptions​(String fileName,
                                                         io.vertx.ext.mongo.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:
      • close

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

        public static MongoGridFsClient newInstance​(io.vertx.ext.mongo.MongoGridFsClient arg)