KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > imageio > event > IIOWriteProgressListener


1 /*
2  * @(#)IIOWriteProgressListener.java 1.18 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.imageio.event;
9
10 import java.util.EventListener JavaDoc;
11 import javax.imageio.ImageWriter JavaDoc;
12
13 /**
14  * An interface used by <code>ImageWriter</code> implementations to notify
15  * callers of their image writing methods of progress.
16  *
17  * @see javax.imageio.ImageWriter#write
18  *
19  * @version 0.5
20  */

21 public interface IIOWriteProgressListener extends EventListener JavaDoc {
22
23     /**
24      * Reports that an image write operation is beginning. All
25      * <code>ImageWriter</code> implementations are required to call
26      * this method exactly once when beginning an image write
27      * operation.
28      *
29      * @param source the <code>ImageWriter</code> object calling this
30      * method.
31      * @param imageIndex the index of the image being written within
32      * its containing input file or stream.
33      */

34     void imageStarted(ImageWriter JavaDoc source, int imageIndex);
35
36     /**
37      * Reports the approximate degree of completion of the current
38      * <code>write</code> call within the associated
39      * <code>ImageWriter</code>.
40      *
41      * <p> The degree of completion is expressed as an index
42      * indicating which image is being written, and a percentage
43      * varying from <code>0.0F</code> to <code>100.0F</code>
44      * indicating how much of the current image has been output. The
45      * percentage should ideally be calculated in terms of the
46      * remaining time to completion, but it is usually more practical
47      * to use a more well-defined metric such as pixels decoded or
48      * portion of input stream consumed. In any case, a sequence of
49      * calls to this method during a given read operation should
50      * supply a monotonically increasing sequence of percentage
51      * values. It is not necessary to supply the exact values
52      * <code>0</code> and <code>100</code>, as these may be inferred
53      * by the callee from other methods.
54      *
55      * <p> Each particular <code>ImageWriter</code> implementation may
56      * call this method at whatever frequency it desires. A rule of
57      * thumb is to call it around each 5 percent mark.
58      *
59      * @param source the <code>ImageWriter</code> object calling this method.
60      * @param percentageDone the approximate percentage of decoding that
61      * has been completed.
62      */

63     void imageProgress(ImageWriter JavaDoc source,
64                        float percentageDone);
65
66     /**
67      * Reports that the image write operation has completed. All
68      * <code>ImageWriter</code> implementations are required to call
69      * this method exactly once upon completion of each image write
70      * operation.
71      *
72      * @param source the <code>ImageWriter</code> object calling this method.
73      */

74     void imageComplete(ImageWriter JavaDoc source);
75
76     /**
77      * Reports that a thumbnail write operation is beginning. All
78      * <code>ImageWriter</code> implementations are required to call
79      * this method exactly once when beginning a thumbnail write
80      * operation.
81      *
82      * @param source the <code>ImageWrite</code> object calling this method.
83      * @param imageIndex the index of the image being written within its
84      * containing input file or stream.
85      * @param thumbnailIndex the index of the thumbnail being written.
86      */

87     void thumbnailStarted(ImageWriter JavaDoc source,
88                           int imageIndex, int thumbnailIndex);
89
90     /**
91      * Reports the approximate degree of completion of the current
92      * thumbnail write within the associated <code>ImageWriter</code>.
93      * The semantics are identical to those of
94      * <code>imageProgress</code>.
95      *
96      * @param source the <code>ImageWriter</code> object calling this
97      * method.
98      * @param percentageDone the approximate percentage of decoding that
99      * has been completed.
100      */

101     void thumbnailProgress(ImageWriter JavaDoc source, float percentageDone);
102
103     /**
104      * Reports that a thumbnail write operation has completed. All
105      * <code>ImageWriter</code> implementations are required to call
106      * this method exactly once upon completion of each thumbnail
107      * write operation.
108      *
109      * @param source the <code>ImageWriter</code> object calling this
110      * method.
111      */

112     void thumbnailComplete(ImageWriter JavaDoc source);
113
114     /**
115      * Reports that a write has been aborted via the writer's
116      * <code>abort</code> method. No further notifications will be
117      * given.
118      *
119      * @param source the <code>ImageWriter</code> object calling this
120      * method.
121      */

122     void writeAborted(ImageWriter JavaDoc source);
123 }
124
Popular Tags