public abstract class AbstractAsyncContentProvider extends Object implements AsyncContentProvider
handleErrorFromInput(Throwable) in case an error
happened during reading from the dataSource and call handleSuccess() when the end of the
stream is reached successfully.| Modifier and Type | Class and Description |
|---|---|
protected static interface |
AbstractAsyncContentProvider.OnlyProcessedHandlingAsyncContentListener
Helper interface to ease the implementation of an
AsyncContentProvider. |
| Constructor and Description |
|---|
AbstractAsyncContentProvider() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closing the content provider.
|
protected abstract void |
doClose() |
Optional<Throwable> |
getFailure()
Returns the error that has happened during processing the content of this provider or
Optional.empty() if there was no failure. |
protected void |
handleErrorFromInput(Throwable failure) |
protected void |
handleSuccess() |
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 AsyncContentProvider.onContent(AsyncContentListener) or
AsyncContentProvider.onSuccess(Runnable) functions. |
AsyncContentProvider |
onSuccess(Runnable action)
Registering an action that will be called when all of the chunks are delivered.
|
protected abstract void |
provideNextChunk(Consumer<ByteBuffer> callback) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetContentLength, getContentTypepublic void close()
AsyncContentProviderclose in interface Closeableclose in interface AutoCloseableclose in interface AsyncContentProviderprotected abstract void doClose()
public final Optional<Throwable> getFailure()
AsyncContentProviderOptional.empty() if there was no failure.getFailure in interface AsyncContentProviderprotected void handleErrorFromInput(Throwable failure)
protected void handleSuccess()
public final boolean isClosed()
AsyncContentProviderisClosed in interface AsyncContentProviderpublic final AsyncContentProvider onContent(AsyncContentListener listener)
AsyncContentProvideronContent in interface AsyncContentProviderlistener - The listener that is called when new data chunk is available.AsyncContentProvider.public final AsyncContentProvider onError(Consumer<Throwable> action)
AsyncContentProviderAsyncCallback.failed(Throwable) call or via an error
during calling the registered listener of AsyncContentProvider.onContent(AsyncContentListener) or
AsyncContentProvider.onSuccess(Runnable) functions.onError in interface AsyncContentProvideraction - The action that must be executed if there is an error.AsyncContentProvider.public final AsyncContentProvider onSuccess(Runnable action)
AsyncContentProviderAsyncContentProvider.onError(Consumer) is called with that exception.onSuccess in interface AsyncContentProvideraction - The action that is called when all of the data chunks are delivered.AsyncContentProvider.protected abstract void provideNextChunk(Consumer<ByteBuffer> callback)
Copyright © 2011–2019 Everit Kft.. All rights reserved.