public class ReactiveGridFsResource extends Object
Constructor and Description |
---|
ReactiveGridFsResource(String filename,
com.mongodb.reactivestreams.client.gridfs.GridFSDownloadPublisher downloadPublisher)
Creates a new, absent
ReactiveGridFsResource . |
Modifier and Type | Method and Description |
---|---|
static ReactiveGridFsResource |
absent(String filename)
Obtain an absent
ReactiveGridFsResource . |
boolean |
exists() |
reactor.core.publisher.Flux<DataBuffer> |
getDownloadStream()
Obtain the download stream emitting chunks of data as they come in.
|
reactor.core.publisher.Flux<DataBuffer> |
getDownloadStream(int chunkSize)
Obtain the download stream emitting chunks of data with given
chunkSize as they come in. |
String |
getFilename() |
reactor.core.publisher.Mono<com.mongodb.client.gridfs.model.GridFSFile> |
getGridFSFile() |
reactor.core.publisher.Mono<InputStream> |
getInputStream()
Obtain the data as
InputStream . |
public ReactiveGridFsResource(String filename, @Nullable com.mongodb.reactivestreams.client.gridfs.GridFSDownloadPublisher downloadPublisher)
ReactiveGridFsResource
.filename
- filename of the absent resource.downloadPublisher
- public static ReactiveGridFsResource absent(String filename)
ReactiveGridFsResource
.filename
- filename of the absent resource, must not be null.public String getFilename() throws IllegalStateException
IllegalStateException
AbstractResource.getFilename()
public reactor.core.publisher.Mono<com.mongodb.client.gridfs.model.GridFSFile> getGridFSFile()
GridFSFile
. Can be null if absent.public reactor.core.publisher.Mono<InputStream> getInputStream() throws IllegalStateException
InputStream
. getDownloadStream()
for large files.IllegalStateException
- if the underlying Publisher
has already been consumed.InputStreamResource.getInputStream()
,
getDownloadStream()
,
DataBufferUtils.join(Publisher)
public reactor.core.publisher.Flux<DataBuffer> getDownloadStream()
Flux.empty()
if the file does not exist.IllegalStateException
- if the underlying Publisher
has already been consumed.InputStreamResource.getInputStream()
,
getDownloadStream()
,
DataBufferUtils.join(Publisher)
public reactor.core.publisher.Flux<DataBuffer> getDownloadStream(int chunkSize)
chunkSize
as they come in.chunkSize
- the preferred number of bytes per emitted DataBuffer
.Flux.empty()
if the file does not exist.IllegalStateException
- if the underlying Publisher
has already been consumed.InputStreamResource.getInputStream()
,
getDownloadStream()
,
DataBufferUtils.join(Publisher)
public boolean exists()
Copyright © 2011–2020 Pivotal Software, Inc.. All rights reserved.