MCPcopy
hub / github.com/google/guava / readBytes

Method readBytes

android/guava/src/com/google/common/io/Files.java:599–609  ·  view source on GitHub ↗

Process the bytes of a file. <p>(If this seems too complicated, maybe you're looking for {@link #toByteArray}.) @param file the file to read @param processor the object to which the bytes of the file are passed. @return the result of the byte processor @throws IOException if an I/O error occurs @d

(File file, ByteProcessor<T> processor)

Source from the content-addressed store, hash-verified

597 * @deprecated Prefer {@code asByteSource(file).read(processor)}.
598 */
599 @Deprecated
600 @InlineMe(
601 replacement = "Files.asByteSource(file).read(processor)",
602 imports = "com.google.common.io.Files")
603 @CanIgnoreReturnValue // some processors won't return a useful result
604 @ParametricNullness
605 public
606 static <T extends @Nullable Object> T readBytes(File file, ByteProcessor<T> processor)
607 throws IOException {
608 return asByteSource(file).read(processor);
609 }
610
611 /**
612 * Computes the hash code of the {@code file} using {@code hashFunction}.

Callers 2

testReadBytesMethod · 0.95

Calls 2

asByteSourceMethod · 0.95
readMethod · 0.45

Tested by 2

testReadBytesMethod · 0.76