/[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.11 by benja, Thu Nov 14 20:05:23 2002 UTC revision 1.12 by benja, Thu Nov 14 20:43:05 2002 UTC
# Line 87  public class TransientPool implements St Line 87  public class TransientPool implements St
87          }          }
88      }      }
89    
90      public Block get(BlockId id) {      public Block get(BlockId id) throws FileNotFoundException {
91            if(!blocks.keySet().contains(id))
92                throw new FileNotFoundException("No such block: "+id);
93    
94          return (Block)blocks.get(id);          return (Block)blocks.get(id);
95      }      }
96      public void add(Block b) {}      public void add(Block b) throws IOException {
97            byte[] body = gzz.util.CopyUtil.readBytes(b.getInputStream());
98            byte[] raw = gzz.util.CopyUtil.readBytes(b.getRawInputStream());
99    
100            InputStream is = b.getRawInputStream();
101            Header822 header = Headers822.readHeader(is);
102            is.close();
103    
104            int headerLength = raw.length - body.length;
105    
106            Block block = new TransientBlock(raw, header, headerLength);
107            BlockId id = block.getId();
108    
109            if(!id.equals(b.getId()))
110                throw new IOException("Block with bad id supplied");
111    
112            blocks.put(block.getId(), block);
113        }
114      public void delete(Block b) {}      public void delete(Block b) {}
115      public Set getIds() { return blocks.keySet(); }      public Set getIds() { return blocks.keySet(); }
116      public BlockOutputStream getBlockOutputStream(String contentType)      public BlockOutputStream getBlockOutputStream(String contentType)

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

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