/**
* @return true - file is ok !
*/
public boolean checkFullFileIntegrity() {
if (length()<PARTSIZE) {
PartHashSet newSet = MD4FileHasher.calcHashSets(writeChannel);
System.out.println(length() + " \nNew hash : " + newSet.getFileHash());
System.out.println("hash : " + getFileHash());
if (newSet.getFileHash().equals(getFileHash()))
return true;
this.partFile.getGapList().addGap(0, length());
return false;
}
if (!hasHashSet()) return false;
PartHashSet fileHashSet = partFile.getFileHashSet();
PartHashSet newSet = MD4FileHasher.calcHashSets(writeChannel);
if (newSet.size()!=fileHashSet.size())
return false;
for(int i = 0;i<fileHashSet.size();i++) {
byte b[] = newSet.get(i);
byte a[] = fileHashSet.get(i);
if (!Arrays.equals(a, b)) {
long begin = PARTSIZE*i;
long end = PARTSIZE*(i+1)-1;
if (end>length()) end = length();
//Adding gap
this.partFile.getGapList().addGap(begin,end);
return false;
}
}
if (!newSet.getFileHash().equals(fileHashSet.getFileHash())) {
partFile.getGapList().addGap(0, length());
return false;