List of usage examples for com.mongodb.gridfs GridFSFile getContentType
public String getContentType()
From source file:com.kurento.kmf.repository.internal.repoimpl.mongo.MongoRepositoryItem.java
License:Open Source License
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; }
From source file:org.craftercms.commons.mongo.FileInfo.java
License:Open Source License
FileInfo(final GridFSFile savedFile, final boolean withInputStream) { this.md5 = savedFile.getMD5(); this.fileId = (ObjectId) savedFile.getId(); this.contentType = savedFile.getContentType(); this.fileSize = FileUtils.readableFileSize(savedFile.getLength()); this.storeName = savedFile.getFilename(); this.savedDate = savedFile.getUploadDate(); this.fileSizeBytes = savedFile.getLength(); if (withInputStream && savedFile instanceof GridFSDBFile) { this.inputStream = ((GridFSDBFile) savedFile).getInputStream(); }/* w w w . jav a 2 s. c o m*/ attributes = new HashMap<>(); }
From source file:org.eclipse.hawkbit.artifact.repository.ArtifactStore.java
License:Open Source License
/** * Maps a single {@link GridFSFile} to {@link DbArtifact}. * * @param tenant/*from ww w .j ava 2 s . c o m*/ * the tenant * @param dbFile * the mongoDB gridFs file. * @return a mapped artifact from the given dbFile */ private static GridFsArtifact map(final GridFSFile fsFile) { if (fsFile == null) { return null; } final GridFsArtifact artifact = new GridFsArtifact(fsFile); artifact.setArtifactId(fsFile.getId().toString()); artifact.setSize(fsFile.getLength()); artifact.setContentType(fsFile.getContentType()); artifact.setHashes(new DbArtifactHash(fsFile.getFilename(), fsFile.getMD5())); return artifact; }