Bundle bundle;
//set data to bundle
//......
File file = new File(context.getFilesDir().getAbsolutePath() + "/data/");
FileOutputStream fos;
try {
fos = new FileOutputStream(file);
//fos.write
fos.close();
} catch (FileNotFoundException exp1) {
exp1.printStackTrace();
} catch (IOException exp2) {
exp2.printStackTrace();
}
我有上述代码。我想要做的就是将包保存到文件中。我发现方法写,但我不能传递一个包,但只有一个字节[]。我试图将该包转换为byte [],但我没有成功。我该怎么做才能做到这一点?什么是最有效的方法?将包保存到文件
你为什么试图编写捆绑文件?相反,为什么不把数据包的数据写入文件? – Antrromet
我该怎么做? –
解释你为什么需要这个。 – Leonidos