Here you can find the source of readFile(String file)
Parameter | Description |
---|---|
file | a parameter |
Parameter | Description |
---|---|
Exception | an exception |
public static byte[] readFile(String file) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; public class Main { /**//from w ww .j a v a 2 s . c o m * Read File and return byte[] * @param file * @return * @throws Exception */ public static byte[] readFile(String file) throws Exception { FileInputStream fis = new FileInputStream(new File(file)); byte[] data = new byte[fis.available()]; fis.read(data); fis.close(); return data; } }