fixed a cache-bug in cachedFileRA

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5445 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent ca80930892
commit ef7fe537c5

@ -94,7 +94,13 @@ public final class kelondroCachedFileRA extends kelondroAbstractRA implements ke
public synchronized void write(final byte[] b, final int off, final int len) throws IOException {
//assert len > 0;
// write to file
if (this.cache.length > 512) this.cache = new byte[512]; // the large cache is only useful during an initialization phase
if (this.cache.length > 512) {
// the large cache is only useful during an initialization phase
byte[] newcache = new byte[512];
System.arraycopy(this.cache, 0, newcache, 0, newcache.length);
this.cache = newcache;
if (this.cachelen > this.cache.length) this.cachelen = this.cache.length;
}
long seekpos = this.RAFile.getFilePointer();
if (this.cachelen + len <= this.cache.length && this.cachestart + this.cachelen == seekpos) {
// append to cache

Loading…
Cancel
Save