posted by Solver Full-stack Developer 2011.06.14 11:50

1. read

 Properties ini = new Properties();
 String mode="";
 ini.load(new FileInputStream("/sdcard/init.ini")); 
 mode=ini.getProperty("version"); 


2.write

Properties ini = new Properties();
ini.put("version", "default"); // property Add
ini.setProperty("version", "single"); 
ini.store(new FileOutputStream("/sdcard/FTPTemp/init.ini",true), "Initialize"); //save
신고
posted by Solver Full-stack Developer 2011.05.13 17:46


File datafile = new File("/sdcard/filename.txt");
  StringBuilder data = new StringBuilder(); 
  try {    
   BufferedReader reader = new BufferedReader(new FileReader(datafile));    
   String readdata;     
   while ((readdata = reader.readLine())!=null) {        
    data.append(readdata); 
    }
   } catch (IOException e) {    
   }
  }



String tmp="";
String url="/sdcard/filename.txt";
  
  try {
   BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(url)), "UTF-8"));
   String line;     
   while ((line = br.readLine()) != null) {        
    tmp+=line;
   }
  } catch (IOException e) { 
  }


FileInputStream fis = new FileInputStream(url);
   Reader in = new InputStreamReader(fis, "UTF-16");
   String tmp="";
   char []buf = new char[fis.available()];
   in.read(buf);
   tmp = new String(buf);
   fis.close();

신고

티스토리 툴바