driver-legacy/src/main/com/mongodb/gridfs/GridFS.java
public GridFSInputFile createFile(final InputStream in, final String filename, final boolean closeStreamOnPersist) {
        return new GridFSInputFile(this, in, filename, closeStreamOnPersist);
    }
public GridFSInputFile createFile(final InputStream in, final String filename, final boolean closeStreamOnPersist) {
        return new GridFSInputFile(this, in, filename, closeStreamOnPersist);
    }
Creates a file entry. After calling this method, you have to call {@link com.mongodb.gridfs.GridFSInputFile#save()}.

@param in                   an inputstream containing the file's data
@param filename             the file name as stored in the db
@param closeStreamOnPersist indicate the passed in input stream should be closed once the data chunk persisted
@return a gridfs input file