Skip to main content

EntryStreamListener

Interface for listening to state changes and exchanging data with an InboxEntryStream instance.

This interface provides callbacks for various events that occur during the lifecycle of an Inbox entry stream, such as starting and ending file sending, requesting file chunks, handling errors, and updating the stream state.

Implement this interface to monitor and interact with the entry stream.

Constructors

EntryStreamListener

public void EntryStreamListener()

Methods

onEndFileSending

Override this method to handle when file was sent successfully.

public void onEndFileSending(
FileInfo file
)

NameTypeDescription
fileFileInfoinformation about the sent file

onError

Override this method to handle event when an error occurs while creating entry.

public void onError(
Throwable throwable
)

NameTypeDescription
throwableThrowableexception that occurred while creating an entry

onErrorDuringSending

Override this method to handle event when an error occurs while sending files.

public void onErrorDuringSending(
FileInfo file,
Throwable throwable
)

NameTypeDescription
fileFileInfoinformation about the file that caused the error
throwableThrowableexception that occurred while sending files

onFileChunkProcessed

Override this method to handle event when each chunk of a file was sent successfully.

public void onFileChunkProcessed(
FileInfo file,
long processedBytes
)

NameTypeDescription
fileFileInfoinformation about the file, which chunk was processed
processedByteslongaccumulated size of sent data

onNextChunkRequest

Override this method to handle event when FileInfo#fileStream is null and the stream requests a chunk of the file to send. If you override this method, you should return the next chunk of the file. Returning null will cause a NullPointerException while sending the file and stop the InboxEntryStream instance with the state State#ERROR.

public byte[] onNextChunkRequest(
FileInfo file
)

NameTypeDescription
fileFileInfoinfo about the file, which chunk is requested

TypeDescription
byte[] next chunk of the file

onStartFileSending

Override this method to handle when the process of sending file starts.

public void onStartFileSending(
FileInfo file
)

NameTypeDescription
fileFileInfoinformation about the file being sent

onUpdateState

Override this method to handle event when stream state has been updated.

public void onUpdateState(
State currentState
)

NameTypeDescription
currentStateStatecurrent state of the stream