Esempio n. 1
0
 @Override
 public int read(byte[] buf, int off, int nbytes) throws IOException {
   if (done) {
     return -1;
   }
   if (count > 0) {
     int r = super.read(buf, off, nbytes);
     if (r != -1) {
       int size = r;
       if (count < size) {
         size = (int) count;
       }
       entry.write(buf, off, size);
       count -= size;
     } else {
       count = 0;
     }
     if (count == 0) {
       done = true;
       entry.verify();
     }
     return r;
   } else {
     done = true;
     entry.verify();
     return -1;
   }
 }
Esempio n. 2
0
 @Override
 public int read() throws IOException {
   if (done) {
     return -1;
   }
   if (count > 0) {
     int r = super.read();
     if (r != -1) {
       entry.write(r);
       count--;
     } else {
       count = 0;
     }
     if (count == 0) {
       done = true;
       entry.verify();
     }
     return r;
   } else {
     done = true;
     entry.verify();
     return -1;
   }
 }