1 package net.javacoding.jspider.core.storage.memory; 2 3 import net.javacoding.jspider.core.storage.spi.ContentDAOSPI; 4 import net.javacoding.jspider.core.storage.spi.StorageSPI; 5 import net.javacoding.jspider.core.model.ResourceInternal; 6 7 import java.io.InputStream ; 8 import java.io.ByteArrayInputStream ; 9 import java.util.Map ; 10 import java.util.HashMap ; 11 12 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 } 35 | Popular Tags |