Micro Focus Content Manager SDK 9.4
|
The DownloadNotifier class provides a streaming interface to document transfers from the workgroup server to the SDK application. During document transfers from the workgroup server to the SDK application, the OnChunkAvailable event is called, to provide real-time notifications of the bytes that are being transferred. This allows the SDK application to access the bytes of the document, before the document has been transferred in its entirety, and is particularly useful for streaming documents onwards from the SDK application to a subsequent receiver. More...
Public Member Functions | |
DownloadNotifier (Database db, long chunkSize=1024 *1024, long startingPosition=0, long endingPosition=-1) | |
Creates a DownloadNotifier instance. More... | |
delegate void | OnChunkAvailableEventHandler (byte[] chunk, long chunkPos, long chunkLen, bool lastChunk) |
OnChunkAvailableEventHandler is the delegate type of the event that that is fired when new data is available. More... | |
Public Member Functions inherited from HP.HPTRIM.SDK.DownloadNotifierBase | |
void | Dispose () |
DownloadNotifierBase (Database db) | |
DownloadNotifierBase (Database db, long startingPosition, long endingPosition) | |
DownloadNotifierBase (Database db, long startingPosition) | |
delegate void | SwigDelegateDownloadNotifierBase_0 (global::System.IntPtr args) |
Events | |
OnChunkAvailableEventHandler | OnChunkAvailable |
OnChunkAvailable is the event that is fired for each new chunk in a document transfer. More... | |
The DownloadNotifier class provides a streaming interface to document transfers from the workgroup server to the SDK application. During document transfers from the workgroup server to the SDK application, the OnChunkAvailable event is called, to provide real-time notifications of the bytes that are being transferred. This allows the SDK application to access the bytes of the document, before the document has been transferred in its entirety, and is particularly useful for streaming documents onwards from the SDK application to a subsequent receiver.
DownloadNotifier provides a unified streaming interface for documents, regardless of whether the document is already present in the local document cache or not. In the case of a document residing in the local document cache, all bytes will be notified immediately.
The following is a simple example of how to use DownloadNotifier.
private void Notifier_OnChunkAvailable(byte[] chunk, long chunkPos, long chunkLen, bool lastChunk) { // ... } Record rec = new Record(db, "Some Record"); int chunkSize = 5000; int startingPosition = 0; int endingPosition = -1; using (DownloadNotifier notifier = new DownloadNotifier(db, chunkSize, startingPosition, endingPosition)) { notifier.OnChunkAvailable += Notifier_OnChunkAvailable; string downloadTo = "C:\\Some Record.doc"; rec.GetDocument(downloadTo, false, "", ""); }
HP.HPTRIM.SDK.DownloadNotifier.DownloadNotifier | ( | Database | db, |
long | chunkSize = 1024*1024 , |
||
long | startingPosition = 0 , |
||
long | endingPosition = -1 |
||
) |
Creates a DownloadNotifier instance.
db | Database connection |
chunkSize | Chunk size. Notifications will not exceed the chunk size. |
startingPosition | Starting positon. Notifications will begin at the starting position in the document. |
endingPosition | Ending position. Notifications will end at the ending position in the document. An ending position of -1 indicates that notifications are requested up to the end of the document. |
delegate void HP.HPTRIM.SDK.DownloadNotifier.OnChunkAvailableEventHandler | ( | byte[] | chunk, |
long | chunkPos, | ||
long | chunkLen, | ||
bool | lastChunk | ||
) |
OnChunkAvailableEventHandler is the delegate type of the event that that is fired when new data is available.
chunk | Chunk. Array of bytes from the document. |
chunkPos | Chunk position. The position in the document where the chunk starts. |
chunkLen | Chunk length. |
lastChunk | Whether this notification is for the last chunk in the notification stream. |
OnChunkAvailableEventHandler HP.HPTRIM.SDK.DownloadNotifier.OnChunkAvailable |
OnChunkAvailable is the event that is fired for each new chunk in a document transfer.