1 19 package org.fjank.jcache; 20 21 import java.io.ByteArrayInputStream ; 22 import java.io.InputStream ; 23 import java.io.OutputStream ; 24 import java.lang.ref.ReferenceQueue ; 25 import javax.util.jcache.CacheException; 26 import javax.util.jcache.InvalidArgumentException; 27 import javax.util.jcache.ObjectNotFoundException; 28 29 37 public class StreamCacheObject extends CacheObject { 38 private byte[] referent; 39 48 public StreamCacheObject( 49 Object key, 50 Object referent, 51 CacheGroup group, 52 CacheRegion region, 53 ReferenceQueue q) throws CacheException { 54 super(key, referent, group, region, q); 55 } 57 58 59 60 65 public InputStream getInputStream() throws ObjectNotFoundException { 66 super.get(); 68 return new ByteArrayInputStream (referent); 69 70 } 71 72 76 public OutputStream getOutputStream() throws InvalidArgumentException { 77 return new CacheOutputStream(this); 78 } 79 80 83 void setReferent(byte[] bs) { 84 referent = bs; 85 } 86 87 } 88 | Popular Tags |