1 package com.atlassian.core.spool;
2
3 import java.io.IOException;
4 import java.io.InputStream;
5 /**
6 * Class that implement this interface will spool data from the provided InputStream, and return a new InputStream
7 * to the spooled data. This is useful in situations when data must be staged between sources due to differences
8 * in IO speeds and resource expenses (for example streaming JDBC blobs from databases to web clients)
9 */
10 public interface Spool
11 {
12 /**
13 * Return a new InputStream to the data provided. Implementations <strong>should</strong> guarantee that the
14 * returned input stream is independent of the stream passed in. For example, the returned InputStream should still
15 * be useable once the original InputStream is closed and its associated resources are released.
16 *
17 * @param streamToSpool - Source stream to be spooled
18 * @return Spooled stream
19 * @throws IOException
20 */
21 InputStream spool(InputStream streamToSpool) throws IOException;
22
23 }