Progress class
Contents
- Introduction to the Library
- Basic support package (com.kryptel.bslx)
- Kryptel API Commons package (com.kryptel)
- ApiHelpers class
- Constants class
- IComponentCapabilities interface
- IComponentState interface
- ICompressionLevelCallback interface
- IDataSink interface
- IKryptelComponent interface
- INotification interface
- IProgressCallback interface
- IReplaceCallback interface
- Loader class
- Message class
- Progress class
- ProgressCallback class
- Cipher package (com.kryptel.cipher)
- Compressor package (com.kryptel.compressor)
- Exceptions package (com.kryptel.exceptions)
- Hash function package (com.kryptel.hash_function)
- MAC function package (com.kryptel.mac)
- Key-related functions (com.kryptel.key)
- Silver Key engine (com.kryptel.silver_key)
- Kryptel encrypted storage (com.kryptel.storage)
Declaration
package com.kryptel; public final class Progress { public Progress(IProgressCallback progressFunc, Object arg) public Progress(IProgressCallback progressFunc, Object arg, long totalSize) public void Discard() throws Exception public boolean NewFile(String path, long fsize) throws Exception public boolean Step(long size) throws Exception }
Description
This is a helper class for file-oriented library components. The class simplifies working with client-supplied IProgressCallback interface.
This class is useful for component authors only; library users should use ProgressCallback class, which helps to implement IProgressCallback interface.
Constructor
public Progress(IProgressCallback progressFunc, Object arg) public Progress(IProgressCallback progressFunc, Object arg, long totalSize)
The constructor links the class to the client-supplied IProgressCallback interface.
Parameters
- progressFunc
- IProgressCallback provided by the user of the component. This argument may be null, in which case all the class methods effectively become no-ops.
- arg
- This argument should be supplied by the client during component initialization. Typically it represents client's execution context; the component just passes it to the callback.
- totalSize
- If this argument > 0, then the progress box should have two bars – File and Total. If this argument <= 0 or missing (first constructor form), the progress box will have only the File bar (i.e. performing a single-file operation).
Discard
public void Discard() throws Exception
This function must be called at the end of processing to remove the progress box. Normally it should be called in a finally block.
NewFile
public boolean NewFile(String path, long fsize) throws Exception
Starts processing of a new file. Arguments path and fsize contain a string to be shown in the box (usually file path) and the file size.
Step
public boolean Step(long size) throws Exception
Notifies the progress callback that next size bytes of the current file have been processed.