public PublicSuffixList parse(final Reader reader) throws IOException {
        final List<String> rules = new ArrayList<>();
        final List<String> exceptions = new ArrayList<>();
        final BufferedReader r = new BufferedReader(reader);

        String line;
        while ((line = r.readLine()) != null) {
            if (line.isEmpty()) {
                continue;
            }
            if (line.startsWith("//")) {
                continue; //entire lines can also be commented using //
            }
            if (line.startsWith(".")) {
                line = line.substring(1); // A leading dot is optional
            }
            // An exclamation mark (!) at the start of a rule marks an exception to a previous wildcard rule
            final boolean isException = line.startsWith("!");
            if (isException) {
                line = line.substring(1);
            }

            if (isException) {
                exceptions.add(line);
            } else {
                rules.add(line);
            }
        }
        return new PublicSuffixList(DomainType.UNKNOWN, rules, exceptions);
    }
Parses the public suffix list format.
<p>
When creating the reader from the file, make sure to use the correct encoding
(the original list is in UTF-8).

@param reader the data reader. The caller is responsible for closing the reader.
@throws IOException on error while reading from list
analyzer/src/main/java/nl/basjes/parse/useragent/utils/publicsuffixlist/PublicSuffixListParser.java