Java File to Byte Array getBytesFromFile(File file)

Here you can find the source of getBytesFromFile(File file)

Description

get Bytes From File

License

Open Source License

Declaration

public static byte[] getBytesFromFile(File file) throws IOException 

Method Source Code

//package com.java2s;
/**//w w w . j  a v a 2 s.  c  o m
 * License: https://github.com/votingsystem/votingsystem/wiki/Licencia
 */

import java.io.*;

public class Main {
    public static byte[] getBytesFromFile(File file) throws IOException {
        byte[] b = new byte[(int) file.length()];
        FileInputStream fs = new FileInputStream(file);
        fs.read(b);
        fs.close();
        return b;
    }
}

Related

  1. getBytesFromFile(File file)
  2. getBytesFromFile(File file)
  3. getBytesFromFile(File file)
  4. getBytesFromFile(File file)
  5. getBytesFromFile(File file)
  6. getBytesFromFile(File file)
  7. getBytesFromFile(File file)
  8. getBytesFromFile(File file)
  9. getBytesFromFile(File file)