public interface AsyncContentProvider extends Closeable
AsyncContentUtil to create standard
providers.| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closing the content provider.
|
Optional<Long> |
getContentLength()
The size of the data that is provided or
Optional.empty() if the length is unknown in
advance. |
Optional<MediaType> |
getContentType()
The media type of the content or
Optional.empty() if the media type is unknown. |
Optional<Throwable> |
getFailure()
Returns the error that has happened during processing the content of this provider or
Optional.empty() if there was no failure. |
boolean |
isClosed()
Returns whether this provider is closed or not.
|
AsyncContentProvider |
onContent(AsyncContentListener listener)
Registering a listener that will be notified if new content is available.
|
AsyncContentProvider |
onError(Consumer<Throwable> action)
Registering a listener that is called if there is an error delivering the data or processing of
the data is failed either via
AsyncCallback.failed(Throwable) call or via an error
during calling the registered listener of onContent(AsyncContentListener) or
onSuccess(Runnable) functions. |
AsyncContentProvider |
onSuccess(Runnable action)
Registering an action that will be called when all of the chunks are delivered.
|
void close()
close in interface AutoCloseableclose in interface CloseableOptional<Long> getContentLength()
Optional.empty() if the length is unknown in
advance.Optional<MediaType> getContentType()
Optional.empty() if the media type is unknown.Optional<Throwable> getFailure()
Optional.empty() if there was no failure.boolean isClosed()
AsyncContentProvider onContent(AsyncContentListener listener)
listener - The listener that is called when new data chunk is available.AsyncContentProvider.AsyncContentProvider onError(Consumer<Throwable> action)
AsyncCallback.failed(Throwable) call or via an error
during calling the registered listener of onContent(AsyncContentListener) or
onSuccess(Runnable) functions.action - The action that must be executed if there is an error.AsyncContentProvider.AsyncContentProvider onSuccess(Runnable action)
onError(Consumer) is called with that exception.action - The action that is called when all of the data chunks are delivered.AsyncContentProvider.Copyright © 2011–2019 Everit Kft.. All rights reserved.