public static void writeBytesToFile() throws IOException{
String s = "aaaaaaaa";
byte[] bs= s.getBytes();
OutputStream out = new FileOutputStream("/storage/sdcard0/aaa");
InputStream is = new ByteArrayInputStream(bs);
byte[] buff = new byte[1024];
int len = 0;
while((len=is.read(buff))!=-1){
out.write(buff, 0, len);
}
is.close();
out.close();
}
将byte数组写入文件
最新推荐文章于 2024-07-04 19:38:49 发布