文件内容不大,直接读到内存中保存就行。

解决方案 »

  1.   


        private void writeFile(String filePath, String content)
        {
            try
            {
                File tfile = new File(filePath);
                RandomAccessFile rdtfile = new RandomAccessFile(tfile, "rw");
                rdtfile.write(content.getBytes("utf-8"));
                //rdtfile.writeUTF(content);        
                rdtfile.close();
            }
            catch (FileNotFoundException e)
            {
                e.printStackTrace();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
        }