driver-legacy/src/main/com/mongodb/gridfs/GridFSInputFile.java
public void save(final long chunkSize) {
        if (outputStream != null) {
            throw new MongoException("cannot mix OutputStream and regular save()");
        }

        // note that chunkSize only changes chunkSize in case we actually save chunks
        // otherwise there is a risk file and chunks are not compatible
        if (!savedChunks) {
            try {
                saveChunks(chunkSize);
            } catch (IOException ioe) {
                throw new MongoException("couldn't save chunks", ioe);
            }
        }

        super.save();
    }
public void save(final long chunkSize) {
        if (outputStream != null) {
            throw new MongoException("cannot mix OutputStream and regular save()");
        }

        // note that chunkSize only changes chunkSize in case we actually save chunks
        // otherwise there is a risk file and chunks are not compatible
        if (!savedChunks) {
            try {
                saveChunks(chunkSize);
            } catch (IOException ioe) {
                throw new MongoException("couldn't save chunks", ioe);
            }
        }

        super.save();
    }
public void save ( final long chunkSize ) { if ( outputStream != null ) { throw new MongoException ( "cannot mix OutputStream and regular save()" ) ; } // note that chunkSize only changes chunkSize in case we actually save chunks // otherwise there is a risk file and chunks are not compatible if ( ! savedChunks ) { try { saveChunks ( chunkSize ) ; } catch ( IOException ioe ) { throw new MongoException ( "couldn't save chunks" , ioe ) ; } } super . save ( ) ; }
This method first calls saveChunks(long) if the file data has not been saved yet. Then it persists the file entry to GridFS.

@param chunkSize Size of chunks for file in bytes.
@throws MongoException if there's a problem saving the file.
This method first calls saveChunks ( long ) if the file data has not been saved yet . Then it persists the file entry to GridFS .