Class GridFSUploadOptions


  • public final class GridFSUploadOptions
    extends java.lang.Object
    GridFS upload options Customizable options used when uploading files into GridFS
    Since:
    3.1
    • Constructor Summary

      Constructors 
      Constructor Description
      GridFSUploadOptions()
      Construct a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      GridFSUploadOptions chunkSizeBytes​(java.lang.Integer chunkSizeBytes)
      Sets the chunk size in bytes.
      java.lang.Integer getChunkSizeBytes()
      The number of bytes per chunk of this file.
      org.bson.Document getMetadata()
      Returns any user provided data for the 'metadata' field of the files collection document.
      GridFSUploadOptions metadata​(org.bson.Document metadata)
      Sets metadata to stored alongside the filename in the files collection
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GridFSUploadOptions

        public GridFSUploadOptions()
        Construct a new instance.
    • Method Detail

      • getChunkSizeBytes

        @Nullable
        public java.lang.Integer getChunkSizeBytes()
        The number of bytes per chunk of this file.

        If no value has been set then, the chunkSizeBytes from the GridFSBucket will be used.

        Returns:
        number of bytes per chunk if set or null
      • chunkSizeBytes

        public GridFSUploadOptions chunkSizeBytes​(@Nullable
                                                  java.lang.Integer chunkSizeBytes)
        Sets the chunk size in bytes.
        Parameters:
        chunkSizeBytes - the number of bytes per chunk for the uploaded file
        Returns:
        this
      • getMetadata

        @Nullable
        public org.bson.Document getMetadata()
        Returns any user provided data for the 'metadata' field of the files collection document.
        Returns:
        the user provided metadata for the file if set or null
      • metadata

        public GridFSUploadOptions metadata​(@Nullable
                                            org.bson.Document metadata)
        Sets metadata to stored alongside the filename in the files collection
        Parameters:
        metadata - the metadata to be stored
        Returns:
        this