38 |
|
|
39 |
package javax.imageio.stream; |
package javax.imageio.stream; |
40 |
|
|
41 |
|
import java.io.InputStream; |
42 |
|
import java.io.IOException; |
43 |
|
|
44 |
/** |
/** |
45 |
* @author Michael Koch (konqueror@gmx.de) |
* @author Michael Koch (konqueror@gmx.de) |
46 |
*/ |
*/ |
47 |
public class MemoryCacheImageInputStream |
public class MemoryCacheImageInputStream extends ImageInputStreamImpl |
48 |
{ |
{ |
49 |
|
private InputStream stream; |
50 |
|
|
51 |
|
public MemoryCacheImageInputStream(InputStream stream) |
52 |
|
{ |
53 |
|
this.stream = stream; |
54 |
|
} |
55 |
|
|
56 |
|
public void close() |
57 |
|
throws IOException |
58 |
|
{ |
59 |
|
super.close(); |
60 |
|
stream.close(); |
61 |
|
} |
62 |
|
|
63 |
|
public void flushBefore(long position) |
64 |
|
throws IOException |
65 |
|
{ |
66 |
|
// FIXME: Implement me. |
67 |
|
throw new Error("not implemented"); |
68 |
|
} |
69 |
|
|
70 |
public boolean isCached() |
public boolean isCached() |
71 |
{ |
{ |
72 |
return true; |
return true; |
81 |
{ |
{ |
82 |
return true; |
return true; |
83 |
} |
} |
84 |
|
|
85 |
|
public int read() |
86 |
|
throws IOException |
87 |
|
{ |
88 |
|
setBitOffset(0); |
89 |
|
return stream.read(); |
90 |
|
} |
91 |
|
|
92 |
|
public int read(byte[] data, int offset, int len) |
93 |
|
throws IOException |
94 |
|
{ |
95 |
|
setBitOffset(0); |
96 |
|
return stream.read(data, offset, len); |
97 |
|
} |
98 |
} |
} |