01: package net.javacoding.jspider.core.storage.memory;
02:
03: import net.javacoding.jspider.core.storage.spi.ContentDAOSPI;
04: import net.javacoding.jspider.core.storage.spi.StorageSPI;
05: import net.javacoding.jspider.core.model.ResourceInternal;
06:
07: import java.io.InputStream;
08: import java.io.ByteArrayInputStream;
09: import java.util.Map;
10: import java.util.HashMap;
11:
12: /**
13: * $Id: ContentDAOImpl.java,v 1.2 2003/04/11 16:37:06 vanrogu Exp $
14: */
15: class ContentDAOImpl implements ContentDAOSPI {
16:
17: protected Map contents;
18: protected StorageSPI storage;
19:
20: public ContentDAOImpl(StorageSPI storage) {
21: this .storage = storage;
22: this .contents = new HashMap();
23: }
24:
25: public InputStream getInputStream(int id) {
26: byte[] bytes = (byte[]) contents.get(new Integer(id));
27: return new ByteArrayInputStream(bytes);
28: }
29:
30: public void setBytes(int id, byte[] bytes) {
31: contents.put(new Integer(id), bytes);
32: }
33:
34: }
|