import java.nio.channels.ClosedChannelException;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
FileChannel fc = fis.getChannel();) {
ByteBuffer buffer = ByteBuffer.allocate(TREE_HEADER_SIZE);
-
buffer.order(ByteOrder.LITTLE_ENDIAN);
buffer.clear();
- fc.read(buffer);
+
+ res = fc.read(buffer);
+ if (res != TREE_HEADER_SIZE) {
+ throw new IOException("Invalid header size"); //$NON-NLS-1$
+ }
+
buffer.flip();
/*
}
@Override
- public HTNode selectNextChild(CoreNode currentNode, long t) throws ClosedChannelException {
+ public Collection<HTNode> selectNextChildren(CoreNode currentNode, long t) throws ClosedChannelException {
assert (currentNode.getNbChildren() > 0);
int potentialNextSeqNb = currentNode.getSequenceNumber();
* node has to be on disk
*/
if (currentNode.isOnDisk()) {
- return fTreeIO.readNode(potentialNextSeqNb);
+ return Collections.singleton(fTreeIO.readNode(potentialNextSeqNb));
}
- return readNode(potentialNextSeqNb);
+ return Collections.singleton(readNode(potentialNextSeqNb));
}
@Override