Class StreamMessages
java.lang.Object
com.linecorp.armeria.common.stream.StreamMessages
A utility class for
StreamMessage
.-
Method Summary
Modifier and TypeMethodDescriptionstatic CompletableFuture<Void>
writeTo
(StreamMessage<? extends HttpData> publisher, Path destination, EventExecutor eventExecutor, ExecutorService blockingTaskExecutor, OpenOption... options) static CompletableFuture<Void>
writeTo
(StreamMessage<? extends HttpData> publisher, Path destination, OpenOption... options)
-
Method Details
-
writeTo
public static CompletableFuture<Void> writeTo(StreamMessage<? extends HttpData> publisher, Path destination, OpenOption... options) Writes the specifiedStreamMessage
to the givenPath
withOpenOption
s. If theOpenOption
s are not specified, they default toStandardOpenOption.CREATE
,StandardOpenOption.TRUNCATE_EXISTING
andStandardOpenOption.WRITE
.- Parameters:
publisher
- the source ofHttpData
to be read from.destination
- thePath
to write to.options
- theOpenOption
s specifying how the file is opened.- Returns:
- a
CompletableFuture
that completes successfully when theStreamMessage
is fully written to thePath
or exceptionally an error occurred while writing theStreamMessage
.
-
writeTo
public static CompletableFuture<Void> writeTo(StreamMessage<? extends HttpData> publisher, Path destination, EventExecutor eventExecutor, ExecutorService blockingTaskExecutor, OpenOption... options) Writes the specifiedStreamMessage
to the givenPath
withOpenOption
s. If theOpenOption
s are not specified, they default toStandardOpenOption.CREATE
,StandardOpenOption.TRUNCATE_EXISTING
andStandardOpenOption.WRITE
.- Parameters:
publisher
- the source ofHttpData
to be read from.destination
- thePath
to write to.eventExecutor
- theEventExecutor
to subscribe to the given publisher.blockingTaskExecutor
- theExecutorService
to which blocking tasks are submitted to handle file I/O events and write operations.options
- theOpenOption
s specifying how the file is opened- Returns:
- a
CompletableFuture
that completes successfully when theStreamMessage
is fully written to thePath
or exceptionally an error occurred while writing theStreamMessage
.
-