comparison servlet/src/digilib/io/ImageCacheStream.java @ 590:69bc69381ac4 stream

more work on stream input and more cleanup
author robcast
date Thu, 06 Jan 2011 20:42:29 +0100
parents
children
comparison
equal deleted inserted replaced
589:73e041c710d3 590:69bc69381ac4
1 /**
2 *
3 */
4 package digilib.io;
5
6 import java.io.InputStream;
7
8 import javax.imageio.stream.ImageInputStream;
9 import javax.imageio.stream.MemoryCacheImageInputStream;
10
11 /**
12 * @author casties
13 *
14 */
15 public class ImageCacheStream extends ImageStream {
16
17 public ImageCacheStream(InputStream stream, String mimeType) {
18 super(stream, mimeType);
19 }
20
21 /*
22 * (non-Javadoc)
23 *
24 * @see digilib.io.ImageInput#hasImageInputStream()
25 */
26 @Override
27 public boolean hasImageInputStream() {
28 return true;
29 }
30
31 /*
32 * (non-Javadoc)
33 *
34 * @see digilib.io.ImageInput#getImageInputStream()
35 */
36 @Override
37 public ImageInputStream getImageInputStream() {
38 /*
39 * TODO: which type of stream backing?
40 * In general, it is preferable to
41 * use a FileCacheImageInputStream when reading from a regular
42 * InputStream. This class is provided for cases where it is not
43 * possible to create a writable temporary file.
44 */
45 ImageInputStream iis = new MemoryCacheImageInputStream(this.stream);
46 return iis;
47 }
48
49 }