Class GridFSInputFile

  • All Implemented Interfaces:
    DBObject, BSONObject

    @Deprecated(since="2021-05-27")
    public class GridFSInputFile
    extends GridFSFile
    Deprecated.
    Usage of this API is not supported in AEM as a Cloud Service.

    This class represents a GridFS file to be written to the database. Operations include:

    • Writing data obtained from an InputStream
    • Getting an OutputStream to stream the data out to
    • Method Detail

      • setId

        public void setId​(java.lang.Object id)
        Deprecated.
        Sets the ID of this GridFS file.
        Parameters:
        id - the file's ID.
      • setFilename

        public void setFilename​(java.lang.String filename)
        Deprecated.
        Sets the file name on the GridFS entry.
        Parameters:
        filename - File name.
      • setContentType

        public void setContentType​(java.lang.String contentType)
        Deprecated.
        Sets the content type (MIME type) on the GridFS entry.
        Parameters:
        contentType - Content type.
      • setChunkSize

        public void setChunkSize​(long chunkSize)
        Deprecated.
        Set the chunk size. This must be called before saving any data.
        Parameters:
        chunkSize - The size in bytes.
      • save

        public void save​(long chunkSize)
        Deprecated.
        This method first calls saveChunks(long) if the file data has not been saved yet. Then it persists the file entry to GridFS.
        Parameters:
        chunkSize - Size of chunks for file in bytes.
        Throws:
        MongoException - if there's a problem saving the file.
      • saveChunks

        public int saveChunks()
                       throws java.io.IOException
        Deprecated.
        Saves all data into chunks from configured InputStream input stream to GridFS.
        Returns:
        Number of the next chunk.
        Throws:
        java.io.IOException - on problems reading the new entry's InputStream.
        MongoException - if there's a failure
        See Also:
        saveChunks(long)
      • saveChunks

        public int saveChunks​(long chunkSize)
                       throws java.io.IOException
        Deprecated.
        Saves all data into chunks from configured InputStream input stream to GridFS. A non-default chunk size can be specified. This method does NOT save the file object itself, one must call save() to do so.
        Parameters:
        chunkSize - Size of chunks for file in bytes.
        Returns:
        Number of the next chunk.
        Throws:
        java.io.IOException - on problems reading the new entry's InputStream.
        MongoException - if there's a failure
      • getOutputStream

        public java.io.OutputStream getOutputStream()
        Deprecated.
        After retrieving this OutputStream, this object will be capable of accepting successively written data to the output stream. To completely persist this GridFS object, you must finally call the OutputStream.close() method on the output stream. Note that calling the save() and saveChunks() methods will throw Exceptions once you obtained the OutputStream.
        Returns:
        Writable stream object.