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
)
Name | Type | Description |
---|---|---|
file | FileInfo | information about the sent file |
onError
Override this method to handle event when an error occurs while creating entry.
public void onError(
Throwable throwable
)
Name | Type | Description |
---|---|---|
throwable | Throwable | exception 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
)
Name | Type | Description |
---|---|---|
file | FileInfo | information about the file that caused the error |
throwable | Throwable | exception 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
)
Name | Type | Description |
---|---|---|
file | FileInfo | information about the file, which chunk was processed |
processedBytes | long | accumulated 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
)
Name | Type | Description |
---|---|---|
file | FileInfo | info about the file, which chunk is requested |
Type | Description |
---|---|
byte[] | next chunk of the file |
onStartFileSending
Override this method to handle when the process of sending file starts.
public void onStartFileSending(
FileInfo file
)
Name | Type | Description |
---|---|---|
file | FileInfo | information about the file being sent |
onUpdateState
Override this method to handle event when stream state has been updated.
public void onUpdateState(
State currentState
)
Name | Type | Description |
---|---|---|
currentState | State | current state of the stream |