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)
| 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}. |