文件讀寫操作

1.將byte[ ] 中的數據保存成文件

File file1 = new File(Environment.getExternalStorageDirectory()+"/h264");
File file2 = new File(file1,"521.h264");
if(file2.exists()){
   file2.delete();
}
file2.createNewFile();
FileOutputStream out = new FileOutputStream(file2);
out.write(byter);
out.flush();
out.clouse();


2.讀取文件,轉爲byte[]
String path = Environment.getExternalStorageDirectory()+"/h264/RGBA8888.bm ;
  File file = new File(path);
InputStream is = new FileInputStream(file);
byte[] b = getBytes(is);

 
 
 

猜你喜欢

转载自blog.csdn.net/chailongger/article/details/80406044