/** * Returns the contents of the given file as a byte array. * @param file the file * @return the byte array form the file * @throws IOException if a problem occurred reading the file. */ protected static byte[] getFileByteContent(File file) throws IOException { try (InputStream stream = new BufferedInputStream(new FileInputStream(file))) { return getInputStreamAsByteArray(stream, (int) file.length()); } }
/** * Returns the contents of the given file as a byte array. * @param file the file * @return the byte array form the file * @throws IOException if a problem occurred reading the file. */ protected static byte[] getFileByteContent(File file) throws IOException { try (InputStream stream = new BufferedInputStream(new FileInputStream(file))) { return getInputStreamAsByteArray(stream, (int) file.length()); } }