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

Method toByteArray

guava/src/com/google/common/io/Files.java:236–238  ·  view source on GitHub ↗

Reads all bytes from a file into a byte array. <p><b>{@link java.nio.file.Path} equivalent:</b> {@link java.nio.file.Files#readAllBytes}. @param file the file to read from @return a byte array containing all the bytes from file @throws IllegalArgumentException if the file is bigger than the larges

(File file)

Source from the content-addressed store, hash-verified

234 * @throws IOException if an I/O error occurs
235 */
236 public static byte[] toByteArray(File file) throws IOException {
237 return asByteSource(file).read();
238 }
239
240 /**
241 * Reads all characters from a file into a {@link String}, using the given character set.

Callers 5

testToByteArrayMethod · 0.95
testWriteBytesMethod · 0.95
testMap_readWriteMethod · 0.95
testReadBytesMethod · 0.95

Calls 2

asByteSourceMethod · 0.95
readMethod · 0.45

Tested by 5

testToByteArrayMethod · 0.76
testWriteBytesMethod · 0.76
testMap_readWriteMethod · 0.76
testReadBytesMethod · 0.76