mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
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:
parent
20958acfd8
commit
bb931c7b83
|
@ -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();
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user