com.mongodb.gridfs.GridFSFile Java Examples

The following examples show how to use com.mongodb.gridfs.GridFSFile. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MongoRepositoryItem.java    From kurento-java with Apache License 2.0 5 votes vote down vote up
private MongoRepositoryItem(MongoRepository repository, GridFSFile dbFile, State state) {

    super(dbFile.getId().toString(), state, loadAttributes(dbFile), repository);

    this.dbFile = dbFile;
    // don't call ours setMetadata(...)
    super.setMetadata(new HashMap<String, String>());
  }
 
Example #2
Source File: MongoGridFSSession.java    From ymate-platform-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public GridFSFile upload(GridFSFileBuilder inputFile) throws Exception {
    GridFSInputFile _inFile = inputFile.build(this);
    _inFile.save();
    return _inFile;
}
 
Example #3
Source File: MongoRepositoryItem.java    From kurento-java with Apache License 2.0 3 votes vote down vote up
private static RepositoryItemAttributes loadAttributes(GridFSFile file) {

    RepositoryItemAttributes attributes = new RepositoryItemAttributes();

    attributes.setContentLength(file.getLength());
    attributes.setLastModified(file.getUploadDate().getTime());
    attributes.setMimeType(file.getContentType());

    return attributes;
  }