public boolean insert(Page target) {
        try {
            String id = target.getURL().toString();
            URL url = new URL(id);
            Path hostPath = getHostPath(url);
            File hostDirectory = hostPath.toFile();
            if (!hostDirectory.exists()) {
                hostDirectory.mkdirs();
            }

            Path filePath = getFilePath(id, hostPath);
            
            try(OutputStream fileStream = new PrintStream(filePath.toFile())) {
                if(compressData) {
                    try(OutputStream gzipStream = new DeflaterOutputStream(fileStream)) {
                        serializeData(target, url, gzipStream);
                    }
                } else {
                    serializeData(target, url, fileStream);
                }
            }
            
        } catch (IOException e) {
            logger.error("Failed to store object in repository.", e);
        }
        
        return false;
    }
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