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

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

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

revision 1.10 by benja, Sat Nov 16 05:03:40 2002 UTC revision 1.11 by benja, Sat Nov 16 05:59:46 2002 UTC
# Line 109  public class DirPool extends AbstractPoo Line 109  public class DirPool extends AbstractPoo
109          return new FileBlock(id);          return new FileBlock(id);
110      }      }
111      public void add(Block b) throws IOException {      public void add(Block b) throws IOException {
112          byte[] bytes = gzz.util.CopyUtil.readBytes(b.getRawInputStream());          File temp = gzz.util.TempFileUtil.tmpFile(dir);
113          BlockId id = BlockId.getIdForData(bytes);          
114            BlockId id = b.getId();
115          if(!id.equals(b.getId()))          InputStream is = id.getCheckedInputStream(b.getRawInputStream());
             throw new IOException("Block with bad id supplied");  
   
116          OutputStream os =          OutputStream os =
117              new BufferedOutputStream(new FileOutputStream(getFile(id)));              new BufferedOutputStream(new FileOutputStream(temp));
118          os.write(bytes);          
119          os.close();          gzz.util.CopyUtil.copy(is, os);
120    
121            if(!temp.renameTo(getFile(id)))
122                throw new IOException("Could not rename temporary file");
123      }      }
124      public void delete(Block b) throws IOException {      public void delete(Block b) throws IOException {
125          getFile(b.getId()).delete();          getFile(b.getId()).delete();

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

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