private Path readNext() {
            if(fileIt != null && !fileIt.hasNext()) {
                IOUtils.closeQuietly(filesStream); // no more files on this folder, close it.
                if(!hostIt.hasNext()) {
                    IOUtils.closeQuietly(hostsStream);
                    return null; // no more file and folders available
                }
                // iterate over next folder available
                Path hostPath = null;
                try {
                    hostPath = hostIt.next();
                    filesStream = Files.newDirectoryStream(hostPath);
                    fileIt = filesStream.iterator();
                } catch (IOException e) {
                    String f = hostPath == null ? null : hostPath.toString();
                    throw new IllegalArgumentException("Failed to open host folder: "+f, e);
                }
            }
            
            if(fileIt != null && fileIt.hasNext()) {
                return fileIt.next();
            }
            
            return null;
        }
A target repository that stores pages in the file system. Files are organized per domain,
one folder for each domain. Supports serialization of data different formats:
- Plain HTML (may lose some data, about headers)
- JSON
- CBOR

@author aeciosantos
ache/src/main/java/achecrawler/target/repository/FileSystemTargetRepository.java