if (tokens == null || tokens.length == 0)
return this;
// Go through each context starting from ours
// check the parents are not leaves.
VirtualFileHandler current = this;
for (int i = 0; i < tokens.length; ++i)
{
if (current.isLeaf())
throw new IOException("File cannot have children: " + current);
if (current instanceof StructuredVirtualFileHandler)
{
StructuredVirtualFileHandler structured = (StructuredVirtualFileHandler) current;
current = structured.createChildHandler(tokens[i]);
}
else
{
String remainingPath = PathTokenizer.getRemainingPath(tokens, i);
return current.findChild(remainingPath);
}
}
// The last one is the result
return current;