private static void _scanFileDir(URL url, int i, int maxLevels, URLScanHandler handler) { if (i > maxLevels) return; handler.handle(url, i); i++; handler.startChildren(i); URLDirectory dir = new URLDirectory(url); for (URL u : dir.list(null)) { _scanFileDir(u, i, maxLevels, handler); } handler.endChildren(i); }