也就是以下过程的逆过程:
  public String selfReadFile(String strFileName){  
StringBuffer   buf=null; 
           BufferedReader   breader = null;//reader   for   the   template   files     
           try       
           {     
             breader = new BufferedReader(new InputStreamReader(new FileInputStream((strFileName)),Charset.forName("utf-8")));  
                 buf   =   new   StringBuffer();     
                 while(breader.ready())       
                       buf.append((char)breader.read());     
                 breader.close();     
           }//try     
           catch(Exception   e)       
           {     
            e.printStackTrace();  
           }//catch     
           return   buf.toString();  
    }     

解决方案 »

  1.   

    对了,我用上面我写的方法之后字符串比文件大5kb左右,然后用这种方法变回文件之后也是比以前大5kb的,没法读…… 
      

  2.   

    InputStream is=null;
    BufferedReader br=null;

    try {
        is=asset.open("airport.txt");
        br=new BufferedReader(new InputStreamReader(is,"GBK"));
        fos=new FileOutputStream("/data/data/com.tarena.android/airport_1.txt");
        String str=null;
        while((str=br.readLine())!=null){
    fos.write(str.getBytes());
    fos.flush();      
        }catch (IOException e) {
    // TODO: handle exception
        }finally{
    if(br!=null)try{br.close();}catch(IOException e){}
    if(is!=null)try{is.close();}catch(IOException e){}
            if(fos!=null)try{fos.close();}catch(IOException e){}
        }