class DigestExtractor {

  @Nullable
  public static String extract(final InputStream stream)
      throws IOException
  {
    checkNotNull(stream);
    try (InputStreamReader isr = new InputStreamReader(ByteStreams.limit(stream, MAX_CHARS_NEEDED),
        StandardCharsets.UTF_8)) {
      return extract(CharStreams.toString(isr));
    }
    finally {
      stream.close();
    }
  }

  private  DigestExtractor();

}