43 |
*/ |
*/ |
44 |
StormPool getPool(); |
StormPool getPool(); |
45 |
|
|
46 |
/** Get an input stream for reading the body of this block. */ |
/** Get an input stream for reading the body of this block. |
47 |
|
* The data is <em>not</em> guaranteed to be verified against |
48 |
|
* the id of this block before you start reading it, i.e. |
49 |
|
* what you read may be spoofed, incorrect data. This is for |
50 |
|
* efficiency: the data may be checked <em>while you read it</em>. |
51 |
|
* If the data is spoofed, a <code>BlockId.WrongIdException</code> |
52 |
|
* will be thrown when you call <code>close()</code> |
53 |
|
* on the <code>InputStream</code> (that's a subclass of |
54 |
|
* <code>IOException</code>). Therefore, <strong>do not forget |
55 |
|
* to call <code>close()</code></strong> before you act on |
56 |
|
* the data returned by this <code>InputStream</code>! |
57 |
|
* <p> |
58 |
|
* Generally there will be no network delays when reading |
59 |
|
* from the input stream, i.e. if the data is retrieved |
60 |
|
* from the network, this method will generally read from |
61 |
|
* a local cache. However, there may be network delays |
62 |
|
* if explicitly specified by a pool's documentation. |
63 |
|
* <p> |
64 |
|
* As usual, you have to be prepared for <code>IOException</code>s |
65 |
|
* while reading from the stream. |
66 |
|
* @return An input stream for reading the body of this block. |
67 |
|
* Will not return <code>null</code>. |
68 |
|
* @throws IOException if an error occurs while opening the |
69 |
|
* input stream; for example, if the block was in |
70 |
|
* a cache but has been pruned since. |
71 |
|
*/ |
72 |
InputStream getInputStream() throws IOException; |
InputStream getInputStream() throws IOException; |
73 |
} |
} |