View Javadoc

1   /*
2    * Callback.java
3    *
4    * Created on December 27, 2006, 8:52 AM
5    *
6    * To change this template, choose Tools | Template Manager
7    * and open the template in the editor.
8    */
9   
10  package org.wiztools.wizcrypt;
11  
12  /***
13   * Implement this interface to write your own monitoring class.
14   * @author subhash
15   * @see WizCrypt
16   * @see WizCrypt#encrypt(InputStream is, OutputStream os, 
17   *      CipherKey ck, Callback cb, long size)
18   * @see WizCrypt#decrypt(InputStream is, OutputStream os, 
19   *      CipherKey ck, Callback cb, long size)
20   */
21  public interface Callback {
22      /***
23       * <code>begin()</code> is called just before the encryption/decryption
24       * process starts.
25       */
26      public void begin();
27      
28      /***
29       * The encryption/decryption process works this way: it loads a bunch of
30       * bytes from the InputStream and writes the processed bunch to the
31       * OutputStream, and then proceeds to read & process the next bunch.
32       * <code>notifyProgress(long value)</code> is called after every
33       * bunch of bytes that have been processed. The <code>value</code> is either
34       * the percentage of the progress in the encryption/decryption process, or
35       * the number of bytes that have been processed. This choice depends on the
36       * parameter given to the <code>WizCrypt</code>'s 
37       * <code>encrypt()</code>/<code>decrypt()</code> method.
38       * 
39       * @see WizCrypt#encrypt(InputStream is, OutputStream os, 
40       *      CipherKey ck, Callback cb, long size)
41       * @see WizCrypt#decrypt(InputStream is, OutputStream os, 
42       *      CipherKey ck, Callback cb, long size)
43       */
44      public void notifyProgress(long value);
45      
46      /***
47       * <code>end()</code> is called immediately after the encryption/decryption
48       * process ends.
49       */
50      public void end();
51  }