List of usage examples for com.mongodb.client.gridfs GridFSBucket downloadToStreamByName
@Deprecated
void downloadToStreamByName(String filename, OutputStream destination);
From source file:net.liaocy.ml4j.nlp.word2vec.Predict.java
private void load(String modelName) throws IOException { MongoDatabase db = Mongo.getDB();/* w w w . j a va 2 s.c o m*/ GridFSBucket gridFSBucket = GridFSBuckets.create(db, "word2vecmodels"); File file = File.createTempFile(modelName, ".w2v"); OutputStream os = new FileOutputStream(file); gridFSBucket.downloadToStreamByName(modelName, os); os.close(); this.vec = WordVectorSerializer.readWord2VecModel(file); // System.out.println(file.getAbsolutePath()); if (!file.delete()) { file.deleteOnExit(); } }