39 |
* detected until an InputStream retrieved from the Block |
* detected until an InputStream retrieved from the Block |
40 |
* is closed. |
* is closed. |
41 |
* <p> |
* <p> |
42 |
* If the block has to be requested from the network, |
* Note: If the block has to be requested from the network, |
43 |
* <code>null</code> is returned and a new thread is spawned |
* this method blocks until it has been loaded! |
44 |
* that performs the request. When the block becomes available, |
* For asynchronous loading, see <code>request()</code>. |
|
* or it becomes known that it cannot be found on the network, |
|
|
* <code>listener.finished()</code> is called. When this method |
|
|
* is called again, it will either return a <code>Block</code> |
|
|
* or throw an exception. [XXX not yet] |
|
45 |
* <p> |
* <p> |
46 |
* Calling <code>getPool()</code> on the returned block may return |
* Calling <code>getPool()</code> on the returned block may return |
47 |
* a different pool than this: If the block is retrieved from |
* a different pool than this: If the block is retrieved from |
50 |
* @throws FileNotFoundException if the block is not found |
* @throws FileNotFoundException if the block is not found |
51 |
* in the pool. |
* in the pool. |
52 |
*/ |
*/ |
53 |
Block get(BlockId id/*, JobListener listener*/) |
Block get(BlockId id) |
54 |
throws FileNotFoundException, IOException; |
throws FileNotFoundException, IOException; |
55 |
|
|
56 |
|
/** Load a block from the network, if it is not available locally. |
57 |
|
* If <code>listener</code> is given, it is informed when |
58 |
|
* the block has either been loaded, or the pool |
59 |
|
* has given up on loading it. |
60 |
|
* XXX |
61 |
|
*/ |
62 |
|
void request(BlockId id, BlockListener listener); |
63 |
|
|
64 |
|
/** Load a block from the network, if it is not available locally. |
65 |
|
* XXX |
66 |
|
* Equivalent to <code>request(id, null)</code>. |
67 |
|
*/ |
68 |
|
void request(BlockId id); |
69 |
|
|
70 |
/** Add a block to this pool. |
/** Add a block to this pool. |
71 |
* The data in the block is checked by this class to assure |
* The data in the block is checked by this class to assure |
72 |
* that the block's id really matches the data in the block. |
* that the block's id really matches the data in the block. |