Class GridFSFile


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

      Constructors 
      Constructor Description
      GridFSFile​(org.bson.BsonValue id, java.lang.String filename, long length, int chunkSize, java.util.Date uploadDate, org.bson.Document metadata)
      Creates a new GridFSFile
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      int getChunkSize()
      The size, in bytes, of each data chunk of this file
      java.lang.String getFilename()
      The filename
      org.bson.BsonValue getId()
      The BsonValue id for this file.
      long getLength()
      The length, in bytes of this file
      org.bson.Document getMetadata()
      Any additional metadata stored along with the file
      org.bson.types.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

        public GridFSFile​(org.bson.BsonValue id,
                          java.lang.String filename,
                          long length,
                          int chunkSize,
                          java.util.Date uploadDate,
                          @Nullable
                          org.bson.Document metadata)
        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
        metadata - the optional metadata for the file
    • Method Detail

      • getObjectId

        public org.bson.types.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 org.bson.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
      • getMetadata

        @Nullable
        public org.bson.Document getMetadata()
        Any additional metadata stored along with the file
        Returns:
        the metadata document or null
      • 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