better handling of array files of length 0

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6355 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 1957b5797a
commit 65b66c2c18

@ -149,9 +149,13 @@ public class ArrayStack implements BLOB {
deletions = false;
for (int i = 0; i < files.length; i++) {
if (files[i].length() >= 19 && files[i].endsWith(".blob")) {
try {
File f = new File(heapLocation, files[i]);
if (f.length() == 0) {
f.delete();
deletions = true;
} else try {
d = DateFormatter.parseShortSecond(files[i].substring(0, 14));
new File(heapLocation, files[i]).renameTo(newBLOB(d));
f.renameTo(newBLOB(d));
deletions = true;
} catch (ParseException e) {continue;}
}
@ -649,6 +653,20 @@ public class ArrayStack implements BLOB {
return -1;
}
/**
* retrieve the sizes of all BLOB
* @param key
* @return the size of the BLOB or -1 if the BLOB does not exist
* @throws IOException
*/
public synchronized long lengthAdd(byte[] key) throws IOException {
long l = 0;
for (blobItem bi: blobs) {
l += bi.blob.length(key);
}
return l;
}
/**
* write a whole byte array as BLOB to the table
* @param key the primary key

Loading…
Cancel
Save