KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > util > cursor > CursorFeed


1 package org.sapia.util.cursor;
2
3 /**
4  * Implementations of this interface are in charge of filling buffers of
5  * objects. This interface is intended to hide how the actual objects are
6  * obtained.
7  *
8  * @author Yanick Duchesne
9  *
10  * <dl>
11  * <dt><b>Copyright: </b>
12  * <dd>Copyright &#169; 2002-2004 <a HREF="http://www.sapia-oss.org">Sapia Open
13  * Source Software </a>. All Rights Reserved.</dd>
14  * </dt>
15  * <dt><b>License: </b>
16  * <dd>Read the license.txt file of the jar or visit the <a
17  * HREF="http://www.sapia-oss.org/license.html">license page </a> at the Sapia
18  * OSS web site</dd>
19  * </dt>
20  * </dl>
21  */

22 public interface CursorFeed {
23
24   /**
25    * This method fills the given array with objects. It returns the number of
26    * objects that were fed into the array.
27    * <p>
28    * <b>NOTE: </b> this method should be implemented as a blocking one.
29    *
30    * @param buffer
31    * an empty array, ready to receive <code>Object</code>s.
32    * @return the number of objects that were fed into the array.
33    * @throws Exception
34    * if a problem occurs.
35    */

36   public int read(Object JavaDoc[] buffer) throws Exception JavaDoc;
37
38   /**
39    * Returns the number of pending objects; this method does not block until
40    * objects are available; it should instead return 0 in such a case.
41    *
42    * @return the number of pending objects held within this instance.
43    * @throws Exception
44    * if a problem occurs.
45    */

46   public int available() throws Exception JavaDoc;
47   
48   /**
49    * Closes this instance. Thereafter, any call on the <code>read()</code> or
50    * <code>available()</code> of this instance will return 0.
51    */

52   public void close();
53
54 }
55
Popular Tags