java.lang.Object
net.i2p.apache.http.conn.util.PublicSuffixListParser

public final class PublicSuffixListParserextends Object
Parses the list from publicsuffix.org and configures a PublicSuffixFilter.
  • Field Details

    • MAX_LINE_LEN

      private static final int MAX_LINE_LEN
      Longest line the parser accepts.
      See Also:
  • Constructor Details

    • PublicSuffixListParser

      public PublicSuffixListParser()
      Creates a parser for the public suffix list file format.
  • Method Details

    • parse

      public PublicSuffixList parse(Reader reader) throws IOException
      Parses the public suffix list format. When creating the reader from the file, make sure to use the correct encoding (the original list is in UTF-8).
      Parameters:
      reader - the data reader. The caller is responsible for closing the reader.
      Returns:
      the parsed suffix rules and exceptions, ready for PublicSuffixList
      Throws:
      IOException - on error while reading from list
    • readLine

      private boolean readLine(Reader r, StringBuilder sb) throws IOException
      Reads one line, stopping at the first whitespace.
      Parameters:
      r - where to read
      sb - receives the line, cleared first
      Returns:
      true if a line was read
      Throws:
      IOException - if the read fails