Class GridFSFile



  • public final class GridFSFile
    extends java.lang.Object
    The GridFSFile
    Since:
    3.1
    • Constructor Summary

      Constructors 
      Constructor Description
      GridFSFile​(BsonValue id, java.lang.String filename, long length, int chunkSize, java.util.Date uploadDate, java.lang.String md5, Document metadata)
      Deprecated. 
      there is no replacement for this constructor
      GridFSFile​(BsonValue id, java.lang.String filename, long length, int chunkSize, java.util.Date uploadDate, java.lang.String md5, Document metadata, Document extraElements)
      Deprecated. 
      there is no replacement for this constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.util.List<java.lang.String> getAliases​()
      Deprecated. 
      any aliases should be stored in the metadata document instead.
      int getChunkSize​()
      The size, in bytes, of each data chunk of this file
      java.lang.String getContentType​()
      Deprecated. 
      content type information should be stored the metadata document instead.
      Document getExtraElements​()
      Deprecated. 
      any extra information should be stored in the metadata document instead.
      java.lang.String getFilename​()
      The filename
      BsonValue getId​()
      The BsonValue id for this file.
      long getLength​()
      The length, in bytes of this file
      java.lang.String getMD5​()
      Deprecated. 
      file hashing is deprecated and may be removed in the future.
      Document getMetadata​()
      Any additional metadata stored along with the file
      ObjectId getObjectId​()
      The ObjectId for this file.
      java.util.Date getUploadDate​()
      The date and time this file was added to GridFS
      int hashCode​()  
      java.lang.String toString​()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • GridFSFile

        @Deprecated
        public GridFSFile​(BsonValue id,
                          java.lang.String filename,
                          long length,
                          int chunkSize,
                          java.util.Date uploadDate,
                          @Nullable
                          java.lang.String md5,
                          Document metadata)
        Deprecated. there is no replacement for this constructor
        Creates a new GridFSFile
        Parameters:
        id - the id of the file
        filename - the filename
        length - the length, in bytes of the file
        chunkSize - the chunkSize, in bytes of the file
        uploadDate - the upload date of the file
        md5 - the hash of the files contents
        metadata - the optional metadata for the file
      • GridFSFile

        @Deprecated
        public GridFSFile​(BsonValue id,
                          java.lang.String filename,
                          long length,
                          int chunkSize,
                          java.util.Date uploadDate,
                          @Nullable
                          java.lang.String md5,
                          @Nullable
                          Document metadata,
                          @Nullable
                          Document extraElements)
        Deprecated. there is no replacement for this constructor
        Creates a legacy implementation of the GridFSFile

        For GridFS files created in older versions of the driver.

        Parameters:
        id - the id of the file
        filename - the filename
        length - the length, in bytes of the file
        chunkSize - the chunkSize, in bytes of the file
        uploadDate - the upload date of the file
        md5 - the hash of the files contents
        metadata - the optional metadata for the file
        extraElements - any extra data stored in the document
    • Method Detail

      • getObjectId

        public ObjectId getObjectId​()
        The ObjectId for this file. Throws a MongoGridFSException if the file id is not an ObjectId.
        Returns:
        the id for this file.
      • getId

        public BsonValue getId​()
        The BsonValue id for this file.
        Returns:
        the id for this file
      • getFilename

        public java.lang.String getFilename​()
        The filename
        Returns:
        the filename
      • getLength

        public long getLength​()
        The length, in bytes of this file
        Returns:
        the length, in bytes of this file
      • getChunkSize

        public int getChunkSize​()
        The size, in bytes, of each data chunk of this file
        Returns:
        the size, in bytes, of each data chunk of this file
      • getUploadDate

        public java.util.Date getUploadDate​()
        The date and time this file was added to GridFS
        Returns:
        the date and time this file was added to GridFS
      • getMD5

        @Deprecated
        @Nullable
        public java.lang.String getMD5​()
        Deprecated. file hashing is deprecated and may be removed in the future.
        The hash of the contents of the stored file
        Returns:
        the hash of the contents of the stored file or null if hashing the contents was disabled.
      • getMetadata

        @Nullable
        public Document getMetadata​()
        Any additional metadata stored along with the file
        Returns:
        the metadata document or null
      • getExtraElements

        @Deprecated
        @Nullable
        public Document getExtraElements​()
        Deprecated. any extra information should be stored in the metadata document instead.
        All deprecated top level elements including any contentType or aliases data
        Returns:
        the extra elements document or null
      • getContentType

        @Deprecated
        public java.lang.String getContentType​()
        Deprecated. content type information should be stored the metadata document instead.
        The content type of the file
        Returns:
        the content type of the file
      • getAliases

        @Deprecated
        public java.util.List<java.lang.String> getAliases​()
        Deprecated. any aliases should be stored in the metadata document instead.
        The aliases for the file
        Returns:
        the aliases of the file
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode​()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString​()
        Overrides:
        toString in class java.lang.Object