allow a digest in Stream
[org.ibex.io.git] / src / org / ibex / io / ByteBufInputStream.java
index bede9d2..064b7bd 100644 (file)
@@ -4,6 +4,7 @@
 
 package org.ibex.io;
 import java.io.*;
+import org.ibex.crypto.*;
 
 /** package-private class */
 abstract class ByteBufInputStream extends InputStream {
@@ -13,6 +14,7 @@ abstract class ByteBufInputStream extends InputStream {
     private byte[] buf = new byte[8192];
     private int start = 0;
     private int end = 0;
+    public  Digest digest = null;
     
     public ByteBufInputStream(InputStream is) {
         this.is = is;
@@ -41,6 +43,8 @@ abstract class ByteBufInputStream extends InputStream {
                         start = end = 0;
                         continue;
                     }
+                } else {
+                    if (digest != null) digest.update(buf, 0, end);
                 }
             } while(end==0);
             if (end == -1) { end = 0; return -1; }