01: package org.columba.core.io;
02:
03: import java.io.File;
04: import java.io.FileNotFoundException;
05: import java.io.FileOutputStream;
06: import java.io.IOException;
07: import java.io.InputStream;
08:
09: public class StreamCacheCopyStream extends PassiveCopyStream {
10:
11: StreamCache cache;
12:
13: Object key;
14:
15: File fileOut;
16:
17: /**
18: * @param in
19: * @param key
20: * @param out
21: * @param cache
22: * @throws FileNotFoundException
23: */
24: public StreamCacheCopyStream(InputStream in, Object key, File out,
25: StreamCache cache) throws FileNotFoundException {
26: super (in, new FileOutputStream(out));
27:
28: this .key = key;
29: this .cache = cache;
30: this .fileOut = out;
31: }
32:
33: /**
34: * {@inheritDoc}
35: */
36: @Override
37: public void close() throws IOException {
38: super.close();
39:
40: cache.add(key, fileOut);
41: }
42:
43: }
|