@Test public void rejectedDigests() { assertThat(DigestExtractor.extract("123456"), is(nullValue())); assertThat(DigestExtractor.extract(""), is(nullValue())); assertThat(DigestExtractor.extract(" "), is(nullValue())); assertThat(DigestExtractor.extract("902a360Xcad98a34b59863c1e65bcf71"), is(nullValue())); }
@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(); } }
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(); } } }
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(); }
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(); @Nullable static String extract(final InputStream stream); @Nullable static String extract(final String input); static boolean isDigest(@Nullable final String digest); }
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(); @Nullable static String extract(final InputStream stream); @Nullable static String extract(final String input); static boolean isDigest(@Nullable final String digest);  }