public class GridFsResource
extends org.springframework.core.io.InputStreamResource
GridFSFile
based Resource
implementation.Constructor and Description |
---|
GridFsResource(com.mongodb.client.gridfs.model.GridFSFile file)
Creates a new
GridFsResource from the given GridFSFile . |
GridFsResource(com.mongodb.client.gridfs.model.GridFSFile file,
InputStream inputStream)
|
Modifier and Type | Method and Description |
---|---|
long |
contentLength() |
String |
getContentType()
Returns the
Resource 's content type. |
String |
getFilename() |
Object |
getId()
Returns the
Resource 's id. |
long |
lastModified() |
equals, exists, getDescription, getInputStream, hashCode, isOpen
public GridFsResource(com.mongodb.client.gridfs.model.GridFSFile file)
GridFsResource
from the given GridFSFile
.file
- must not be null.public GridFsResource(com.mongodb.client.gridfs.model.GridFSFile file, InputStream inputStream)
file
- must not be null.inputStream
- must not be null.public long contentLength() throws IOException
contentLength
in interface org.springframework.core.io.Resource
contentLength
in class org.springframework.core.io.AbstractResource
IOException
public String getFilename() throws IllegalStateException
getFilename
in interface org.springframework.core.io.Resource
getFilename
in class org.springframework.core.io.AbstractResource
IllegalStateException
public long lastModified() throws IOException
lastModified
in interface org.springframework.core.io.Resource
lastModified
in class org.springframework.core.io.AbstractResource
IOException
public Object getId()
Resource
's id.public String getContentType()
Resource
's content type.com.mongodb.MongoGridFSException
- in case no content type declared on GridFSFile.getMetadata()
nor
provided via GridFSFile.getContentType()
.Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.