/[gzz]/gzz/lava/gzz/storm/impl/TransientPool.java
ViewVC logotype

Diff of /gzz/lava/gzz/storm/impl/TransientPool.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by benja, Sat Nov 16 04:38:04 2002 UTC revision 1.17 by benja, Sat Nov 16 05:59:46 2002 UTC
# Line 75  public class TransientPool extends Abstr Line 75  public class TransientPool extends Abstr
75          return (Block)blocks.get(id);          return (Block)blocks.get(id);
76      }      }
77      public void add(Block b) throws IOException {      public void add(Block b) throws IOException {
78          byte[] body = gzz.util.CopyUtil.readBytes(b.getInputStream());          byte[] bytes = gzz.util.CopyUtil.readBytes(b.getRawInputStream());
         byte[] raw = gzz.util.CopyUtil.readBytes(b.getRawInputStream());  
79    
80          InputStream is = new ByteArrayInputStream(raw);          BlockId id = b.getId();
81            id.check(bytes);
82    
83            InputStream is = new ByteArrayInputStream(bytes);
84          Header822 header = Headers822.readHeader(is);          Header822 header = Headers822.readHeader(is);
85          is.close();          is.close();
86    
87          Block block = new TransientBlock(BlockId.getIdForData(raw),          Block block = new TransientBlock(id, bytes, header);
88                                           raw, header);          blocks.put(id, block);
         BlockId id = block.getId();  
   
         if(!id.equals(b.getId()))  
             throw new IOException("Block with bad id supplied");  
   
         blocks.put(block.getId(), block);  
89      }      }
90      public void delete(Block b) {      public void delete(Block b) {
91          blocks.keySet().remove(b.getId());          blocks.keySet().remove(b.getId());

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26