public class ReactiveGridFsResource extends AbstractResource
GridFSFile
based Resource
implementation.Constructor and Description |
---|
ReactiveGridFsResource(com.mongodb.client.gridfs.model.GridFSFile file,
org.reactivestreams.Publisher<DataBuffer> content)
Creates a new
ReactiveGridFsResource from the given GridFSFile . |
Modifier and Type | Method and Description |
---|---|
static ReactiveGridFsResource |
absent(String filename)
Obtain an absent
ReactiveGridFsResource . |
long |
contentLength() |
boolean |
exists() |
String |
getDescription() |
reactor.core.publisher.Flux<DataBuffer> |
getDownloadStream()
Retrieve the download stream using the default chunk size of 256 kB.
|
reactor.core.publisher.Flux<DataBuffer> |
getDownloadStream(int chunkSize)
Retrieve the download stream.
|
String |
getFilename() |
com.mongodb.client.gridfs.model.GridFSFile |
getGridFSFile() |
Object |
getId()
Returns the
Resource 's id. |
InputStream |
getInputStream() |
long |
lastModified() |
createRelative, equals, getFile, getFileForLastModifiedCheck, getURI, getURL, hashCode, isFile, isOpen, isReadable, readableChannel, toString
public ReactiveGridFsResource(com.mongodb.client.gridfs.model.GridFSFile file, org.reactivestreams.Publisher<DataBuffer> content)
ReactiveGridFsResource
from the given GridFSFile
.file
- must not be null.content
- public static ReactiveGridFsResource absent(String filename)
ReactiveGridFsResource
.filename
- filename of the absent resource, must not be null.public InputStream getInputStream() throws IllegalStateException
IllegalStateException
public long contentLength() throws IOException
contentLength
in interface Resource
contentLength
in class AbstractResource
IOException
public String getFilename() throws IllegalStateException
getFilename
in interface Resource
getFilename
in class AbstractResource
IllegalStateException
public boolean exists()
exists
in interface Resource
exists
in class AbstractResource
public long lastModified() throws IOException
lastModified
in interface Resource
lastModified
in class AbstractResource
IOException
public String getDescription()
public Object getId()
Resource
's id.IllegalStateException
- if the file does not exists()
.@Nullable public com.mongodb.client.gridfs.model.GridFSFile getGridFSFile()
GridFSFile
. Can be null if absent.public reactor.core.publisher.Flux<DataBuffer> getDownloadStream()
public reactor.core.publisher.Flux<DataBuffer> getDownloadStream(int chunkSize)
Copyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.