【发布时间】:2010-12-31 08:12:43
【问题描述】:
我正在从服务器获取字节块,我需要将它们写入文件而不覆盖旧块。我怎样才能做到这一点? 我是这样做的..
private void createMapFile(String fileName, byte mapBytes[]) throws IOException
{
File filePath = new File(Environment.getExternalStorageDirectory()+"/map/"+fileName);
PrintWriter pw = new PrintWriter(new FileOutputStream(filePath, true));
pw.print(mapBytes);
pw.flush();
pw.close(); }
我的这个方法将文件名和字节块作为参数。每当我从服务器获取新块时,都会调用此方法。通过这种方法,我无法将所有块写入文件。
任何帮助将不胜感激。 谢谢
【问题讨论】: