Skip to content

Instantly share code, notes, and snippets.

@AlbertHG
Created July 26, 2016 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlbertHG/3c6bd410a14628107b93c22ac0e315fd to your computer and use it in GitHub Desktop.
Save AlbertHG/3c6bd410a14628107b93c22ac0e315fd to your computer and use it in GitHub Desktop.
读取二进制文件
/**
* 读取二进制文件
* @author A
*
*/
class BinaryFile {
public static byte[] read(File file) throws IOException {
BufferedInputStream bf = new BufferedInputStream(new FileInputStream(file));
try {
byte[] data = new byte[bf.available()];
bf.read(data);
return data;
} finally {
bf.close();
}
}
final static byte[] raed (String bFile) throws IOException{
return read(new File(bFile).getAbsoluteFile());
}
}
@AlbertHG
Copy link
Author

简化二进制读取文件过程

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment