fix for some improper details in kelondroDyn

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2104 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
orbiter 2006-05-15 21:50:22 +00:00
parent 20958acfd8
commit bb931c7b83
2 changed files with 10 additions and 7 deletions

View File

@ -44,6 +44,7 @@
package de.anomic.kelondro;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Iterator;
@ -80,7 +81,7 @@ abstract class kelondroAbstractRA implements kelondroRA {
len -= r;
}
}
/*
public byte[] readFully() throws IOException {
ByteArrayOutputStream dest = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
@ -94,7 +95,7 @@ abstract class kelondroAbstractRA implements kelondroRA {
dest.close();
return dest.toByteArray();
}
*/
public byte readByte() throws IOException {
final int ch = this.read();
if (ch < 0) throw new IOException();

View File

@ -349,11 +349,13 @@ public class kelondroDyn extends kelondroTree {
}
public int read(byte[] b, int off, int len) throws IOException {
byte[] buf = getDyn(filekey, seekpos, len);
if (buf == null) return 0;
System.arraycopy(buf, 0, b, off, len);
seekpos += len;
return len;
int l = Math.min(b.length - off, len);
byte[] buf = getDyn(filekey, seekpos, l);
if (buf == null) return -1;
l = Math.min(buf.length, l);
System.arraycopy(buf, 0, b, off, l);
seekpos += l;
return l;
}
public void write(byte[] b, int off, int len) throws IOException {