Class BinaryParser

java.lang.Object
it.unimi.dsi.law.warc.parser.BinaryParser
All Implemented Interfaces:
com.google.common.base.Predicate<Response>, Filter<Response>, Parser, Cloneable, Predicate<Response>

public class BinaryParser
extends Object
implements Parser
A universal binary parser that just computes digests.
  • Constructor Details

    • BinaryParser

      public BinaryParser​(MessageDigest messageDigest)
      Builds a parser for digesting a page.
      Parameters:
      messageDigest - the digesting algorithm, or null if no digesting will be performed.
    • BinaryParser

      public BinaryParser​(String messageDigestAlgorithm) throws NoSuchAlgorithmException
      Builds a parser for digesting a page.
      Parameters:
      messageDigestAlgorithm - the digesting algorithm (as a string).
      Throws:
      NoSuchAlgorithmException
  • Method Details

    • parse

      public byte[] parse​(Response response, Parser.LinkReceiver linkReceiver) throws IOException
      Description copied from interface: Parser
      Parses a response.
      Specified by:
      parse in interface Parser
      Parameters:
      response - a response to parse.
      linkReceiver - a link receiver.
      Returns:
      a byte digest for the page, or null if no digest has been computed.
      Throws:
      IOException
    • apply

      public boolean apply​(Response response)
      Specified by:
      apply in interface com.google.common.base.Predicate<Response>
    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • guessedCharset

      public String guessedCharset()
      Description copied from interface: Parser
      Returns a guessed charset for the document, or null if the charset could not be guessed.
      Specified by:
      guessedCharset in interface Parser
      Returns:
      a charset or null.